2.1 strangness

D-Man dsh8290 at rit.edu
Thu May 31 12:34:27 EDT 2001


On Thu, May 31, 2001 at 05:13:53PM +0100, Robin Becker wrote:
| This is a condensation of some weirds I'm seeing with M2Crypto which I
| downloaded today; I'm running SF 2.1 for win32
| 
| ##################################
| #file ttt.py
| from httplib import *
| 
| class Bongo(HTTPConnection):
|         pass
| ##################################
| 
| when I attempt to run this
| 
| C:\Python\devel\m2crypto-0.06-snap5-win32\demo\ssl>python \tmp\ttt.py
| Traceback (most recent call last):
|   File "\tmp\ttt.py", line 3, in ?
|     class Bongo(HTTPConnection):
| NameError: name 'HTTPConnection' is not defined
| 
| but certainly httplib has a class HTTPConnection
<snip>
| Changing the * to HTTPConnection in ttt.py removes the problem.
<snip>

It is supposed to be that way :


Python 2.1 (#1, Apr 17 2001, 09:45:01)
[GCC 2.95.3-2 (cygwin special)] on cygwin_nt-4.01
Type "copyright", "credits" or "license" for more information.
>>>
>>> import httplib
>>> print httplib.__all__
['HTTP']
>>>


See http://www.python.org/doc/essays/packages.html under the heading
"Importing * From a Package; the __all__ Attribute" about a quarter of
the way down.

-D





More information about the Python-list mailing list