Den Thu, 05 Jan 2006 14:53:40 +0800. skrev limodou:

> 2006/1/5, Thomas Dybdahl Ahle <[EMAIL PROTECTED]>:
>> Is it possible for an imported module to find its own location?
> 
> you can access __file__(missing for built-in modules) or __path__(used
> for a package) attribute to find a module's location.

Super, what I needed seems to be os.chdir(os.path.dirname(__file__)).
Works flawlessly. Thank you.

-- 
Programmers should realize their critical importance and responsibility in a
world gone digital. They are in many ways similar to the priests and monks of
Europe's Dark Ages; they are the only ones with the training and insight
to read and interpret the "scripture" of this age.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to