Thursday 19 September 2013

python module is in which file on the filesystem

I wanted a quick way to find out which file contains certain python modules, this can by done by looking at __file__ variable for a module.

e.g. in the interpreter
>>> import pygame
>>> print pygame.__file__

/usr/lib64/python2.7/site-packages/pygame/__init__.pyc