[Pythonmac-SIG] Run Python module directly from Terminal?

Andrew Jaffe a.h.jaffe at gmail.com
Tue May 24 23:16:37 CEST 2005


> Chinook ~ 81 $"/usr/local/bin/python"  "/Users/Chinook/PythonProjects/
> MyUtilities/ConvertFile.py" "/Users/Chinook/TestFiles/AtoB.txt" &&
> echo Exit status: $? && exit 1
>
> <process log output>
>
> Exit status: 0
>
> So what's my problem?  Well I know I could reduce the typing with
> some aliasing in my .profile file,  but I'm wondering if there is not
> a simpler/direct way of accomplishing a basic task such as this?

And just to make some of the other bits more explicit, which you've 
probably already worked out anyway: first, you don't need any of the 
quotes, since none of the filenames have spaces or other weird 
characters. Second, /usr/local/bin is likely already in your path. 
Third, if you are also already in the directory with AtoB.txt, all you 
need is probably

$ python /Users/Chinook/PythonProjects/MyUtilities/ConvertFile.py 
AtoB.txt

(unless you've written the script in such a way that it needs the 
absolute path)

A



More information about the Pythonmac-SIG mailing list