How to use a python package - shouldn't i be able to access anything listed in __all__?
I'm trying to use the pyupnp package (http://code.google.com/p/pyupnp/)
I've built and installed it and in my code I have:
import pyupnp
b = pyupnp.UpnpBase()
.开发者_如何学运维..
But I get this error: AttributeError: 'module' object has no attribute 'UpnpBase'
Now I had a look in the code for the package, and it has the following:
__all__ = [
'UpnpNamespace',
'UpnpDevice',
'UpnpBase',
...
I thought that I would be able to access anything in the __all__
list? What am I doing wrong?
Thanks so much
Looking at this package, you should import pyupnp.upnp
, not pyupnp
. The contents of __all__
are irrelevant here.
精彩评论