Need some help with Python 2.6 (resolved)

Discussion in 'Mac Programming' started by Forsaken, Dec 13, 2009.

  1. Forsaken macrumors regular

    Forsaken

    Joined:
    Dec 1, 2009
    #1
    NOTE: I've figured everything out now. I also switched to 3.0

    This has been bugging me for quite some time.

    I just started seriously using Python (in this case, version 2.6) and made this .py script:
    Code:
    #easy!
    print "Mary had a little lamb,"
    print "it's fleece was white as snow;"
    print "and everywhere that Mary went",
    print "her lamb was sure to go."
    
    when I import it into IDLE it works fine.

    But when I drag it to Python Launcher, PL opens very quickly then closes, within the space of a second. Same for Build Applet. And when I launch it from the finder into IDLE, it just shows the code, not the result. I mean, the files are placed in an area searched by sys.path (my documents folder) but nothing works. Help?
     
  2. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #2
    Well, you could start with a proper shebang at the beginning of your script:

    #!/usr/bin/env python

    If you haven't already, try making the script executable (chmod +x).
     
  3. Forsaken thread starter macrumors regular

    Forsaken

    Joined:
    Dec 1, 2009
    #3
    Actually, about making it an applet or app is irrelevant at the moment, and I discovered that when I open it and shows only the code, it's the edit window, not the actual prompt window. So it's been resolved.
     

Share This Page