paths: sleeping at the wheel
aleaxit at yahoo.com
Tue Jun 19 18:40:11 CEST 2001
"david winkler" <winkler at abaqus-sn.com> wrote in message
news:3B2F7682.D5C65F3 at abaqus-sn.com...
> I have been using Python for a while and have just noticed that when
> accessing a script from the command line like this: "python
> scriptname.py", the path must be cwd or fully qualified. I have tried
> setting my system path without success. Is there a workaround to this
> limitation (or a clarification to my misunderstanding)? I already know
> how to avoid this type of situation by running the script like this:
> "scriptname". I also know how to access modules using PYTHONPATH.
There is no workaround that I know of to the limitation you
correctly noticed. python.exe (or the python executable, on
non-Windows platforms) would have to be modified to remove
this limitation (or, to put it the other way 'round, to add
to it some presumably-optional feature to search for the main
script along some kind of 'path' -- presumably only if the
main script is supplied as a bare filename bereft of path
and such a named file is not found in the current directory).
If you want to write down the specifications for the new
requested features, it could go into a PEP -- don't worry
about implementing it, that will be easily done if the PEP
is approved, but rather about the pro's and con's of the
proposed enhancement. Biggest pro I can think of is that
people ASSUME the feature already exists and are surprised
to find out it doesn't -- therefore, on the principle of
least surprise, I guess it should go in, unless some serious
contraindications should emerge...?
More information about the Python-list