Hi Kent, Thank you
I was able to find it in the end. <blushes> It was at the bottom of the file I was editing </blushes> Lance Kent Johnson wrote: > Lance Haig wrote: >> I am debugging a script that was written by someone else and I was >> wondering if there is a way to determine where a function or module >> is imported from > > You can use the __file__ attribute of a module: > In [9]: csv.__file__ > Out[9]: > '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/csv.pyc' > > For a function use the __module__ attribute to get the module: > In [10]: csv.reader.__module__ > Out[10]: '_csv' > > This is a string so you have to do a little more work to get the file: > > In [12]: import sys > In [13]: sys.modules[csv.reader.__module__].__file__ > Out[13]: > '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/lib-dynload/_csv.so' > > > > Kent > _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
