[Python-bugs-list] [ python-Bugs-416089 ] import problem with 2.1c1
noreply@sourceforge.net
noreply@sourceforge.net
Sat, 14 Apr 2001 16:54:08 -0700
Bugs item #416089, was updated on 2001-04-14 02:39
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=416089&group_id=5470
Category: Python Library
Group: None
>Status: Closed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Guido van Rossum (gvanrossum)
Summary: import problem with 2.1c1
Initial Comment:
I have built Python 2.1c1 under Linux and Irix
without the thread module. When I import
threading an ImportError occurs as expected.
However, reissuing the import threading (not reloading)
statement does not raise an ImportError. This causes a
failure in the regression tests with the
following error message:
test test_threadedtempfile crashed --
exceptions.AttributeError: 'threading' module has no
attribute 'Event'
Here is a sample session from the interactive
interpreter.
>% ./python
Python 2.1c1 (#4, Apr 14 2001, 03:22:09)
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)]
on linux2
Type "copyright", "credits" or "license" for more
information.
>>> import threading
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/home/raj/python/dist/src/Lib/threading.py",
line 5, in ?
import thread
ImportError: No module named thread
>>> import threading # No import error here
>>>
and under IRIX
% ./python
Python 2.1c1 (#3, Apr 13 2001, 21:38:25) [C] on irix646
Type "copyright", "credits" or "license" for more
information.
>>> import threading
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/usr/people/raj/python/dist/src/Lib/threading.py",
line 5, in
?
import
thread
ImportError: No module named thread
>>> import threading # Again no import error
here
>>>
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-04-14 16:54
Message:
Logged In: YES
user_id=6380
I fixed the specific issue with the test suite.
The more general issue can't be fixed. The first time you
import threading it fails, not on the import of threading
itself (which is always around), but on the import of thread
(which is a built-in module that's only there when you
enable threading). The second time you import threading,
you get a stub of the threading module (initialized up to
the point where threading.py tried to import thread).
Unfortunately there are good and deep reasons why the
threading module can't just be deleted after its
initialization failed. (One being that you might want to
debug the situation.)
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2001-04-14 13:19
Message:
Logged In: YES
user_id=31435
Assigned to Guido, because I suspect he just fixed this in
the CVS tree.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=416089&group_id=5470