
exarkun at divmod
May 21, 2007, 6:39 AM
Post #3 of 10
(95 views)
Permalink
|
|
Re: howto check does module 'asdf' exist? (is available for import)
[In reply to]
|
|
On 21 May 2007 06:17:16 -0700, dmitrey <openopt [at] ukr> wrote: >howto check does module 'asdf' exist (is available for import) or no? >(without try/cache of course) >Thx in advance, D. > You could use twisted.python.modules: $ python Python 2.4.3 (#2, Oct 6 2006, 07:52:30) [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from twisted.python.modules import getModule >>> from sys import modules >>> 'Numeric' in modules False >>> getModule('Numeric') PythonModule<'Numeric'> >>> 'Numeric' in modules False >>> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list
|