How do I find out what file an import is using?
D'Arcy Cain
darcy at druid.net
Wed May 9 14:09:42 EDT 2012
On 12-05-09 01:52 PM, Rob Richardson wrote:
> I am trying to work with a Python script someone else wrote. The script includes the line
> from Level3Utils import *
>
> I need to look at the functions that are included in that import. In an effort to identify exactly which file is being used, I renamed the Level3Utils.py and Level3Utils.pyc files in the same folder as the script I'm working on. The import command in PythonWin executed without error. I looked for a file named Level3Utils.py in my Python tree (d:/Python25, in my case). None were there. I then commented out the import line and stepped through the code. It ran without error! The class that should have come from Level3Utils executed successfully without being imported!
>>> import Level3Utils
>>> Level3Utils.__file__
--
D'Arcy J.M. Cain <darcy at druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
IM: darcy at Vex.Net
More information about the Python-list
mailing list