Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > pywhich script - where is that module?

Reply
Thread Tools

pywhich script - where is that module?

 
 
Keith Dart
Guest
Posts: n/a
 
      12-17-2004
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 <>
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)

 
Reply With Quote
 
 
 
 
Thomas Guettler
Guest
Posts: n/a
 
      12-17-2004
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/


 
Reply With Quote
 
 
 
 
Dennis Benzinger
Guest
Posts: n/a
 
      12-17-2004
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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
PyWhich Billy Mays Python 11 08-05-2011 02:56 PM
How to execute a script from another script and other script does notdo busy wait. Rajat Python 3 01-08-2010 02:05 PM
RE: How to execute a script from another script and other script doesnotdo busy wait. VYAS ASHISH M-NTB837 Python 2 01-07-2010 08:18 PM
How to make Perl Script "POST" call from another Perl Script??? Wet Basement Perl 1 07-15-2003 10:25 PM



Advertisments