git.fiddlerwoaroof.com
modpath
a9a3e556
 #!/usr/bin/python -O
d316e383
 """Print the path to a python module"""
a9a3e556
 import os
 import os.path
 import sys
 import imp
 
 module = sys.argv[1].split('.')
 module[0] = imp.find_module(module[0])[1]
 try:
 	filename = reduce(lambda a,b: imp.find_module(b, [a])[1], module)
 except ImportError:
 	filename = reduce(lambda a,b: imp.find_module(b, [a])[1], module[:-1])
 
 print filename