import pickle succeeds only after two tries??

Nick Welch mack at incise.org
Tue Sep 23 05:08:35 EDT 2003


On Tue, Sep 23, 2003 at 10:59:03AM +0200, Bram Stolk wrote:
> The first 'import pickle' fails with "ImportError: No module named StringIO"
> If I immediately do a second 'import pickle', it works????
> 
<snip>
> 
> I find this extremely strange.
> What could be going on here?

Not sure about the exact problem you're having with pickle, however, the
import issue you are having is a general Python issue, not specific to
pickle or anything.

death at two ~ % echo 'print hello' > foo.py
death at two ~ % python
Python 2.3+ (#2, Sep  8 2003, 20:36:54) 
[GCC 3.3.1 20030626 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import foo 
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "foo.py", line 1, in ?
    print hello
NameError: name 'hello' is not defined
>>> import foo
>>> 

-- 
Nick Welch aka mackstann | mack @ incise.org | http://incise.org
When you make your mark in the world, watch out for guys with erasers.
		-- The Wall Street Journal





More information about the Python-list mailing list