Find the path of a Python module
19/06/2009The builtin inspect module makes it easy to find out information about the modules you are loading. Just ‘import inspect’ and use inspect.getfile
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import inspect
>>> import random
>>> inspect.getfile(random)
‘c:\\Python26\\lib\\random.pyc’
There is 1 comment in this article: