directories problem

Dan Perl dperl at rogers.com
Mon Sep 13 23:44:47 EDT 2004


Many thanks, Peter!  Just like someone in the thread you are mentioning, I 
have to go now and change a few scripts that I have.

And I guess that should give a solution for Lowell also.  In each script 
that's called with os.system( ), get the path of the script (use 
os.path.split) and append the 'config.txt' file (use os.path.join).

Dan

"Peter Hansen" <peter at engcorp.com> wrote in message 
news:_66dnRiFcJCGxNvcRVn-pA at powergate.ca...
> Dan Perl wrote:
>
>> I'm not sure whether this is what Lowell is looking for, but I've been 
>> looking at a similar problem and I would also like to see a solution for 
>> that: can a python script know its own full path name?
>
> See near the end of this thread: 
> http://groups.google.ca/groups?threadm=8089854e.0407070426.2fb90f95%40posting.google.com
>
> Also note that scripts other than the main one can do it even more
> easily: __file__, or if that's not always an absolute path, 
> os.path.abspath(__file__).
>
> -Peter 





More information about the Python-list mailing list