[Pythonmac-SIG] Yet another problem with path

Kevin Walzer kw at codebykevin.com
Mon Jul 14 03:50:12 CEST 2008


Pascal Bompard wrote:
> Yes, I am aware that I could do that. I chose to only demonstrate the 
> full path method rather than both ways to access the file in my example.
> 
> The problem remains though, that every time I want to run a script in 
> that directory, I'd have to type out the entire path, which is not ideal.
> 
> Surely there must be a work around to allow me to only type in the 
> script name, at least I assume there must be?

I guess I'm confused. There are only two ways to run a script: with the 
absolute path to the script, or with a relative path (from the same 
directory as the script, or with the path to the script in another 
directory in the same path hierarchy, i.e. "python foo/myscript.py," in 
a subdirectory called foo).

All the variables you have set--$PATH, etc.-- help Terminal know where 
Python is. They do not help Python know where your script is.
-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com


More information about the Pythonmac-SIG mailing list