directories problem

Dan Perl dperl at rogers.com
Tue Sep 14 04:21:29 CEST 2004


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?

Dan

"Lowell Kirsh" <lkirsh at cs.ubc.ca> wrote in message 
news:ci5jf2$t60$1 at mughi.cs.ubc.ca...
> I'm trying to write a script in python to run several other python scripts 
> using os.system(scriptName). Many of those other scripts have lines in 
> them which look something like:
>   doSomething('config.txt')
> where config.txt is a file in the same directory as scriptName. When I run 
> scriptName from its own directory, it is able to find config.txt. But when 
> I run scriptName from another directory, it can't find the file because 
> it's looking in the directory of the script which called it rather than 
> its own directory. Is there any way around this?
>
> Lowell 





More information about the Python-list mailing list