[Pythonmac-SIG] Yet another problem with path

Pascal Bompard pascal.bompard at gmail.com
Mon Jul 14 04:07:36 CEST 2008


I see what you are saying. It didn't occur to me that Python would not  
use any of those variables, not even $PYTHONPATH. Thank you for  
pointing that out.

I suppose the next best strategy should be to look into using a  
terminal shortcut to at least make the "cd" to the directory a bit  
less painful.

> 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.

>> 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?


More information about the Pythonmac-SIG mailing list