[Pythonmac-SIG] Run Python module directly from Terminal?
Les Hill
leshill at gmail.com
Tue May 24 04:22:31 CEST 2005
On 5/23/05, Lee Cullens <lee_cullens at mac.com> wrote:
> 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?
Not sure if this is what you are asking but doing the following as the
very first line of the script:
#!/usr/bin/env python
And then adding the directory where the script is located to your
path, for example in your .profile:
export PATH=~/Python/scripts:$PATH
Finally, make sure the script has the appropriate permissions
(execute) by doing the following in a shell where you have moved to
the scripts directory:
chmod a+x SCRIPTNAME
This (admittedly second nature to Unix geeks) straightforward setup
should allow you to do the following at the shell command line:
wonderland: % your_script_here.py file_to_convert
will invoke your script with your_script_here.py as sys.argv[0] and
file_to_convert as sys.argv[1].
--
Les Hill
leshill at gmail.com
More information about the Pythonmac-SIG
mailing list