Executing Python Scripts on Mac using Python Launcher
Hans Mulder
hansmu at xs4all.nl
Tue Jun 26 16:12:54 EDT 2012
On 26/06/12 21:51:41, Dennis Lee Bieber wrote:
> On Tue, 26 Jun 2012 10:19:45 -0700 (PDT), David Thomas
> <dthomas86 at me.com> declaimed the following in gmane.comp.python.general:
>
>
>> http://www.freeimagehosting.net/ilbqt
>
> That's an interesting configuration...
>
> "pythonw.exe" is a version of the Python interpreter designed to NOT
> OPEN a console -- so you've got a configuration saying "open a console
> to run a no-console interpreter".
That's on Windows; on the Mac python and pythonw are identical.
In fact, they're hard links to the same file.
> Normally pythonw.exe is used with scripts having .pyw extension;
> these are scripts that use tkinter, wxPython, or other GUI system to
> create a graphical environment and don't want a console (terminal)
> window cluttering the screen when they don't use text I/O.
>
> Console based programs (.py) should be run using python.exe; adjust
> your settings.
That shouldn't matter on a Mac.
You may want to check "allow #! to override", though.
I mean, if there is a #! in a file pointing to a specific version of
python, then it's probably there for a reason. For example, the script
might use a third party module installed only in that Python install.
>> http://www.freeimagehosting.net/r5ars
>
> And this is to be expected... In Python 2.x, "input()" attempts to
> evaluate the input data, and you didn't supply anything -- hence EOF.
> For your usage, you want "raw_input()", which just grabs the next line
> of text and returns it as a string.
What he says.
> As for how to run if you've opened a console (shell [bash]) window,
> the way to run a script is to type
>
> python <path/name/to/your/script>.py <any command line arguments>
Hope this helps,
-- HansM
More information about the Python-list
mailing list