Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
List of modules available for import inside Python?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  17 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ssecorp  
View profile  
 More options Aug 28 2008, 12:21 am
Newsgroups: comp.lang.python
From: ssecorp <circularf...@gmail.com>
Date: Wed, 27 Aug 2008 21:21:36 -0700 (PDT)
Local: Thurs, Aug 28 2008 12:21 am
Subject: List of modules available for import inside Python?
Is there a way to view all the modules I have available for import
from within Python?
Like writing in the interpreter:
import.modules

Also, is there anything like Cpan for Python?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Rebert  
View profile  
 More options Aug 28 2008, 12:54 am
Newsgroups: comp.lang.python
From: "Chris Rebert" <cvreb...@gmail.com>
Date: Wed, 27 Aug 2008 21:54:23 -0700
Local: Thurs, Aug 28 2008 12:54 am
Subject: Re: List of modules available for import inside Python?

On Wed, Aug 27, 2008 at 9:21 PM, ssecorp <circularf...@gmail.com> wrote:
> Is there a way to view all the modules I have available for import
> from within Python?
> Like writing in the interpreter:
> import.modules

> Also, is there anything like Cpan for Python?

The closest thing would be PyPI (the Python Package Index)
[http://pypi.python.org/pypi], and easy_install (a package manager for
Python) [http://peak.telecommunity.com/DevCenter/EasyInstall].

- Chris
========
Follow the path of the Iguana...
Rebertia: http://rebertia.com
Blog: http://blog.rebertia.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Mills  
View profile  
 More options Aug 28 2008, 12:48 am
Newsgroups: comp.lang.python
From: "James Mills" <prolo...@shortcircuit.net.au>
Date: Thu, 28 Aug 2008 14:48:58 +1000
Local: Thurs, Aug 28 2008 12:48 am
Subject: Re: List of modules available for import inside Python?

On Thu, Aug 28, 2008 at 2:21 PM, ssecorp <circularf...@gmail.com> wrote:
> Also, is there anything like Cpan for Python?

Try the Python Cheese Shop / PyPi

http://pypi.python.org/pypi

cheers
James

--
--
-- "Problems are solved by method"


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fredrik Lundh  
View profile  
(1 user)  More options Aug 28 2008, 2:04 am
Newsgroups: comp.lang.python
From: Fredrik Lundh <fred...@pythonware.com>
Date: Thu, 28 Aug 2008 08:04:53 +0200
Local: Thurs, Aug 28 2008 2:04 am
Subject: Re: List of modules available for import inside Python?

ssecorp wrote:
> Is there a way to view all the modules I have available for import
> from within Python?
> Like writing in the interpreter:
> import.modules

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".

also see:

http://effbot.org/zone/listmodules-cgi.htm

</F>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michele Simionato  
View profile  
(1 user)  More options Aug 28 2008, 2:12 am
Newsgroups: comp.lang.python
From: Michele Simionato <michele.simion...@gmail.com>
Date: Wed, 27 Aug 2008 23:12:04 -0700 (PDT)
Local: Thurs, Aug 28 2008 2:12 am
Subject: Re: List of modules available for import inside Python?
On Aug 28, 6:21 am, ssecorp <circularf...@gmail.com> wrote:

> Is there a way to view all the modules I have available for import
> from within Python?
> Like writing in the interpreter:

Try:

>>> help()

help> modules
Please wait a moment while I gather a list of all available modules...
<snip>

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
prueba...@latinmail.com  
View profile  
(1 user)  More options Aug 28 2008, 10:42 am
Newsgroups: comp.lang.python
From: prueba...@latinmail.com
Date: Thu, 28 Aug 2008 07:42:29 -0700 (PDT)
Local: Thurs, Aug 28 2008 10:42 am
Subject: Re: List of modules available for import inside Python?
On Aug 28, 12:21 am, ssecorp <circularf...@gmail.com> wrote:

> Is there a way to view all the modules I have available for import
> from within Python?
> Like writing in the interpreter:
> import.modules

> Also, is there anything like Cpan for Python?

Isn't the most obvious answer to the first question this link?

http://docs.python.org/modindex.html


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fredrik Lundh  
View profile  
 More options Aug 28 2008, 12:10 pm
Newsgroups: comp.lang.python
From: Fredrik Lundh <fred...@pythonware.com>
Date: Thu, 28 Aug 2008 18:10:43 +0200
Local: Thurs, Aug 28 2008 12:10 pm
Subject: Re: List of modules available for import inside Python?

prueba...@latinmail.com wrote:
>> Is there a way to view all the modules I have available for import
>> from within Python?
>> Like writing in the interpreter:
>> import.modules

>> Also, is there anything like Cpan for Python?

> Isn't the most obvious answer to the first question this link?

depends on whether you want a list of the modules that you might be able
to import, or the modules that are actually present on your system.

</F>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason Scheirer  
View profile  
(2 users)  More options Aug 28 2008, 2:23 pm
Newsgroups: comp.lang.python
From: Jason Scheirer <jason.schei...@gmail.com>
Date: Thu, 28 Aug 2008 11:23:01 -0700 (PDT)
Local: Thurs, Aug 28 2008 2:23 pm
Subject: Re: List of modules available for import inside Python?
On Aug 27, 11:04 pm, Fredrik Lundh <fred...@pythonware.com> wrote:

I like to direct new users to pydoc's built-in HTTP server:

import pydoc
pydoc.gui()
(then click the 'open browser' button)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mblume  
View profile  
 More options Aug 28 2008, 3:32 pm
Newsgroups: comp.lang.python
From: mblume <mbl...@socha.net>
Date: 28 Aug 2008 19:32:13 GMT
Local: Thurs, Aug 28 2008 3:32 pm
Subject: Re: List of modules available for import inside Python?
Am Thu, 28 Aug 2008 11:23:01 -0700 schrieb Jason Scheirer:

> I like to direct new users to pydoc's built-in HTTP server:

> import pydoc
> pydoc.gui()
> (then click the 'open browser' button)

Now, this is cool !

Thanks a lot!

Martin


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
clurker  
View profile  
 More options Sep 6 2008, 4:18 pm
Newsgroups: comp.lang.python
From: clurker <nos...@spamhaters.com>
Date: Sat, 06 Sep 2008 15:18:55 -0500
Local: Sat, Sep 6 2008 4:18 pm
Subject: Re: List of modules available for import inside Python?

Michele Simionato wrote:
> On Aug 28, 6:21 am, ssecorp <circularf...@gmail.com> wrote:
>> Is there a way to view all the modules I have available for import
>> from within Python?
>> Like writing in the interpreter:

> Try:

>>>> help()
> help> modules
> Please wait a moment while I gather a list of all available modules...
> <snip>

This looks like it could be a useful tool, but when I try it
I get the following:

Please wait a moment while I gather a list of all available modules...

/usr/lib/python2.5/site-packages/reportlab/lib/PyFontify.py:35:
Warning: 'with' will become a reserved keyword in Python 2.6
/usr/lib/python2.5/site-packages/reportlab/lib/PyFontify.py:36:
Warning: 'with' will become a reserved keyword in Python 2.6
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site.py", line 346, in __call__
    return pydoc.help(*args, **kwds)
  File "/usr/lib/python2.5/pydoc.py", line 1645, in __call__
    self.interact()
  File "/usr/lib/python2.5/pydoc.py", line 1663, in interact
    self.help(request)
  File "/usr/lib/python2.5/pydoc.py", line 1679, in help
    elif request == 'modules': self.listmodules()
  File "/usr/lib/python2.5/pydoc.py", line 1797, in listmodules
    ModuleScanner().run(callback)
  File "/usr/lib/python2.5/pydoc.py", line 1848, in run
    for importer, modname, ispkg in pkgutil.walk_packages():
  File "/usr/lib/python2.5/pkgutil.py", line 110, in walk_packages
    __import__(name)
  File "/usr/local/lib/python2.5/site-packages/PIL/__init__.py", line 1342,
in <module>

  File "/usr/local/lib/python2.5/site-packages/PIL/__init__.py", line 927,
in main

UnboundLocalError: local variable 'given_files' referenced before assignment


which could be because I am fairly free and unrestrained when
it comes to installing stuff, and I see now I have modules
on both /usr/lib/python2.5 and /usr/local/lib/python2.5

Apparently python knows about them both, but I don't know I
haven't introduced an incompatibility somewhere...and that PIL
package showing up at the tail of the errors was one of my
more recent additions...

Any help will be appreciated,

sc


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gabriel Genellina  
View profile  
 More options Sep 7 2008, 7:32 am
Newsgroups: comp.lang.python
From: "Gabriel Genellina" <gagsl-...@yahoo.com.ar>
Date: Sun, 07 Sep 2008 08:32:30 -0300
Local: Sun, Sep 7 2008 7:32 am
Subject: Re: List of modules available for import inside Python?
En Sat, 06 Sep 2008 17:18:55 -0300, clurker <nos...@spamhaters.com> escribió:

Unfortunately the "modules" help command actually imports all the available packages, and a buggy one may stop the whole process with an error.

> Apparently python knows about them both, but I don't know I
> haven't introduced an incompatibility somewhere...and that PIL
> package showing up at the tail of the errors was one of my
> more recent additions...

If import of a package fails, the error reported is not accurate. In this case, probably some other package failed, that itself imported PIL. Line 927 in PIL/__init__.py does not exist.

A quick fix is to replace line 1854 in pydoc.py (ModuleScanner.run) with this one:

        for importer, modname, ispkg in pkgutil.walk_packages(onerror=lambda name:None):

(the onerror argument makes it to ignore all errors)

--
Gabriel Genellina


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sc  
View profile  
 More options Sep 7 2008, 4:56 pm
Newsgroups: comp.lang.python
From: sc <nos...@spamhaters.com>
Date: Sun, 07 Sep 2008 15:56:54 -0500
Local: Sun, Sep 7 2008 4:56 pm
Subject: Re: List of modules available for import inside Python?

nice Gabriel, thanx!  At least now "help(); modules" gives me a beautiful
list -- I guess I'll find out what the buggy module is if/when I try
to use it...(all PIL/__init__.py is is about 15 lines of comments
(referencing a README I can't find))

sc


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
deni...@t-online.de  
View profile  
 More options Sep 10 2008, 6:52 am
Newsgroups: comp.lang.python
From: deni...@t-online.de
Date: Wed, 10 Sep 2008 03:52:09 -0700 (PDT)
Local: Wed, Sep 10 2008 6:52 am
Subject: Re: List of modules available for import inside Python?

> > A quick fix is to replace line 1854 in pydoc.py (ModuleScanner.run) with
> > this one:

> >         for importer, modname, ispkg in
> >         pkgutil.walk_packages(onerror=lambda name:None):

> > (the onerror argument makes it to ignore all errors)

well not all, for example
GLUT: Fatal Error in summon: could not open display: :0.0

So to refine the question:
   how can I list all modules that might be importable on my system,
   without actually importing them all ?

(How about a "pydoc2" that's well thought out, doesn't crash ...
let me ask more knowledgable people, what's a good small help system
as model ?
)

cheers
  -- denis


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fredrik Lundh  
View profile  
 More options Sep 10 2008, 7:45 am
Newsgroups: comp.lang.python
From: Fredrik Lundh <fred...@pythonware.com>
Date: Wed, 10 Sep 2008 13:45:54 +0200
Local: Wed, Sep 10 2008 7:45 am
Subject: Re: List of modules available for import inside Python?

deni...@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".

also see:

http://effbot.org/zone/listmodules-cgi.htm

...

</F>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michele Simionato  
View profile  
 More options Sep 10 2008, 8:10 am
Newsgroups: comp.lang.python
From: Michele Simionato <michele.simion...@gmail.com>
Date: Wed, 10 Sep 2008 05:10:09 -0700 (PDT)
Local: Wed, Sep 10 2008 8:10 am
Subject: Re: List of modules available for import inside Python?
On Sep 10, 1:45 pm, Fredrik Lundh <fred...@pythonware.com> wrote:

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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fredrik Lundh  
View profile  
 More options Sep 10 2008, 8:43 am
Newsgroups: comp.lang.python
From: Fredrik Lundh <fred...@pythonware.com>
Date: Wed, 10 Sep 2008 14:43:17 +0200
Local: Wed, Sep 10 2008 8:43 am
Subject: Re: List of modules available for import inside Python?

it does indeed import modules found in the path if they appear to be
Python C extensions.  why Ubuntu puts badly written C modules in their
default Python path is more than I can tell...

</F>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anita Kean  
View profile  
 More options Sep 10 2008, 5:57 pm
Newsgroups: comp.lang.python
From: Anita Kean <ak...@paradise.net.nz>
Date: 11 Sep 2008 09:57:06 +1200
Local: Wed, Sep 10 2008 5:57 pm
Subject: Re: List of modules available for import inside Python?
On 2008-09-10, deni...@t-online.de <deni...@t-online.de> wrote:

> (snip) ...

> So to refine the question:
>    how can I list all modules that might be importable on my system,
>    without actually importing them all ?

> (How about a "pydoc2" that's well thought out, doesn't crash ...
> let me ask more knowledgable people, what's a good small help system
> as model ?
> )

I'm constantly finding myself wishing for this feature -
something of the "apropos"/"whatis" of the linux shell (and debian's
"apt-cache search" and "apt-cache show" which allow you to search
and query before you install).
(Matlab's "help" and "lookfor" commands cover this too.)

Is there a reason this type of information hasn't been made available
by default in the help system?
I'm constantly using find, grep and Usenet to find out what python tools
I can use.

Anita


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google