By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,400 Members | 1,334 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,400 IT Pros & Developers. It's quick & easy.

pywhich script - where is that module?

P: n/a
Have you ever wondered where your python modules get imported from?
Here is a little script, called "pywhich", that will tell you.

--
\/ \/
(O O)
-- --------------------oOOo~(_)~oOOo----------------------------------------
Keith Dart <kd***@kdart.com>
public key: ID: F3D288E4
================================================== ==========================

#!/usr/bin/env python

"""pywhich <modname>
Tell which Python module is imported.
"""

import sys

def main(argv):
if len(argv) < 2:
print __doc__
return
for modname in argv[1:]:
try:
mod = __import__(modname)
except:
print "No module or package by named '%s' found." % modname
else:
print "%15s : %s" % (modname, mod.__file__)

main(sys.argv)

Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Am Fri, 17 Dec 2004 09:09:25 +0000 schrieb Keith Dart:
Have you ever wondered where your python modules get imported from?
Here is a little script, called "pywhich", that will tell you.


Nice, you could add it to the python cookbook.

Thomas
--
Thomas GŁttler, http://www.thomas-guettler.de/
Jul 18 '05 #2

P: n/a
Thomas Guettler wrote:
[...]
Nice, you could add it to the python cookbook.
[...]


Just in the case the OP doesn't know where to find the cookbook:
http://aspn.activestate.com/ASPN/Cookbook/Python/
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.