Determine path of current module?
Darrell Gallion
darrell at dorb.com
Thu Jul 20 14:40:34 EDT 2000
>>> print sys.modules['stat']
<module 'stat' from 'D:\Python\Lib\stat.pyc'>
# sys is a builtin
>>> sys.__file__
Traceback (innermost last):
File "<stdin>", line 1, in ?
AttributeError: __file__
>>> import os
>>> os.__file__
'D:\\Python\\Lib\\os.pyc'
>>>
--Darrell
----- Original Message -----
From: "Carsten Gaebler" <cg at schlund.de>
> Well, that's just the filename. What I'm looking for is the complete path,
> "d:\tmp\mypath.py" in this case.
>
More information about the Python-list
mailing list