List of modules available for import inside Python?

Michele Simionato michele.simionato at gmail.com
Wed Sep 10 08:10:09 EDT 2008


On Sep 10, 1:45 pm, Fredrik Lundh <fred... at pythonware.com> wrote:
> deni... at t-online.de wrote:
> >    how can I list all modules that might be importable on my system,
> >    without actually importing them all ?
>
> I'm pretty sure I mentioned a way to do that back when this thread was
> opened.  let's see, yes, here it is:
>
> ...
>
> there's a helper script in the 2.5 source code kit that locates all
> existing standard modules:
>
> http://svn.python.org/projects/python/tags/r252/Doc/tools/listmodules.py
>
> to get all modules, remove the for-loop that follows after the comment
> "get rid of site packages".

I have just tried the following on my Ubuntu box with the system
Python:

~$ python /usr/lib/python2.5/doc/tools/listmodules.py
/usr/lib/python2.5/doc/tools/listmodules.py:99: DeprecationWarning:
the rgbimg module is deprecated
  __import__(m)

** (process:24863): WARNING **: AT_SPI_REGISTRY was not started at
session startup.

** (process:24863): WARNING **: Could not locate registry
location: /usr/lib/xulrunner-1.9.0.1/libxpcom.so
before 3
/usr/lib/python2.5/doc/tools/listmodules.py:99: Warning: cannot
register existing type `GtkSourceStyleScheme'
  __import__(m)
/usr/lib/python2.5/doc/tools/listmodules.py:99: Warning:
g_type_set_qdata: assertion `node != NULL' failed
  __import__(m)
/usr/lib/python2.5/doc/tools/listmodules.py:99: Warning: cannot
register existing type `GtkSourceBuffer'
  __import__(m)
/usr/lib/python2.5/doc/tools/listmodules.py:99: Warning:
g_type_get_qdata: assertion `node != NULL' failed
  __import__(m)
Segmentation fault

Interesting, isn't it?

       Michele Simionato



More information about the Python-list mailing list