Referencing resources from python

Noam Aigerman noama at answers.com
Mon Feb 16 19:41:26 EST 2009


Hi,

What is the best way to reference a non-python file's path from inside
python ?

Until now, I (stupidly) had such lines  as:

 

theFile=open('../somefile.txt')

 

in my  python files. Now I moved my python files to another dir, and all
those relative filenames broke.

On the other hand, the solution of writing the full path of each
resource isn't welcome either, as we're working from a SVN repository
and we sometimes checkout to different dir's. I am sure there is a third
way which didn't occur to me... 

What do you recommend?

Thanks, Noam

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090217/081fb1f3/attachment.html>


More information about the Python-list mailing list