executing python code
dd55 at cornell.edu
Sat Nov 6 00:21:11 CET 2004
Michael Fuhr wrote:
> Darren Dale <dd55 at cornell.edu> writes:
>> Some time ago I asked about executing a python program or script. For
>> windows, I was informed that the .py extension could be added to some
>> list of executable extensions, and then I could just type "mycode"
>> instead of "python mycode.py". Great advice, worked like a charm.
>> I recently jumped ship, and have been running Gentoo Linux for about two
>> months. Is it possible to get the same behavior on Linux? I thought it
>> would have something to do with adding the #!/usr/bin/env python line to
>> my code, but I'm not sure what this is supposed to do (it didnt work,
>> that much I know.)
> How didn't it work? What did you do and what happened? What errors
> were printed? Did you use chmod to make the script executable? Is
> the script in a directory that's in your PATH? Is Python installed
> on the system?
Yes, I did chmod, the script is in the current directory.
bash: mycode.py: command not found
I just tried:
and that will execute.
More information about the Python-list