pywhich script - where is that module?

K

Keith Dart

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 <[email protected]>
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)
 
T

Thomas Guettler

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top