Search path for python script
Steve Holden
steve at holdenweb.com
Wed Sep 12 20:37:43 EDT 2007
grt wrote:
> I'm new to python, running it under cygwin. This must be easy but I
> haven't figured it out. I'm trying to run a script by typing:
>
> python test.py
>
> where test.py is in a directory I've added to PYTHONPATH, but test.py
> is not found. Perhaps PYTHONPATH only applies to modules imported
> within a script. I didn't notice an option to python to search the
> standard path, like Perl -S.
>
> How is this done?
>
The PYTHONPATH is only used to augment sys.path, which in turn is only
used for locating modules to import.
If you want to locate scripts then just put them on your PATH, and make
sure they are +x with a shebang line (#!/usr/bin/env python is the
commonest) at the head.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------
More information about the Python-list
mailing list