Super Beginner Python Help

Discussion in 'Mac Programming' started by DairyJogger, Feb 24, 2011.

  1. DairyJogger macrumors newbie

    Feb 24, 2011
    Okay, I have decided that I would like to learn some programming, and have taken to MIT's OpenCourseware lectures/curriculum to aid me in this process. I have no previous programming experience.

    I saw this "Hello, world!" program and decided to give a test-run just to make sure everything was working properly, my IDLE search path was in order, etc.

    I attempted to run this simple program, yet I keep getting a syntax error, and I literally have no idea why. I will take you step by step through what I did, because I feel quite dumb for not understanding this simple procedure.

    FYI, I am running Python 2.7, which I DL off the Python site on Mac OS X 10.6. I am also referencing this:

    So I opened IDLE, and typed:

    print "Hello, world!"

    i saved this as a and then proceeded to follow all the directions that the wiki gave in Terminal. yet, in Terminal, I keep getting this error:


    Note* I tried print("Hello, World!") also, same thing.

    Can someone please tell me what the heck I am doing wrong? Am I completely misguided here?
  2. kainjow Moderator emeritus


    Jun 15, 2000
    Sounds like you saved the entire contents of IDLE's window to, which isn't what you want.

    I'd suggest not using IDLE since Terminal already provides what you need.

    Open up in TextEdit and make sure the contents of the file are only
    print "Hello, world!"
    and then try again.
  3. subsonix macrumors 68040

    Feb 2, 2008
    I have no idea, it might be related to the fact that you use a different version than the system supplied. Any specific reason you did this? I mean why make things more complicated than they need to.

    Anyway, try copy paste this into terminal.

    echo "print 'hello'" > ; python
    It will leave a file behind named Does it work to use the interactive interpreter? ie just type python at the command line?

Share This Page