How do I find out what file an import is using?

Rob Richardson RDRichardson at rad-con.com
Wed May 9 13:52:45 EDT 2012


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!

How do I find out where the class definition actually is?

(There is no PYTHONPATH environmental variable defined on my machine.)

Thanks very much!

RobR



More information about the Python-list mailing list