import pickle succeeds only after two tries??

Bram Stolk bram at nospam.sara.nl
Tue Sep 23 04:59:03 EDT 2003


Hello,


I am using python-2.2.2 on linux-ARM.
Python itself works OK.
However, importing pickle gives me *very* strange results:

The first 'import pickle' fails with "ImportError: No module named StringIO"
If I immediately do a second 'import pickle', it works????

See this log:

Python 2.2.2 (#1, Mar 26 2003, 03:05:45)
[GCC 2.95.3 20010315 (release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import pickle
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/usr/lib/python2.2/pickle.py", line 971, in ?
     from StringIO import StringIO
ImportError: No module named StringIO
 >>> import pickle
 >>> dir(pickle)
['APPEND', 'APPENDS', 'BINFLOAT', 'BINGET', 'BININT', 'BININT1', 
'BININT2', 'BINPERSID', 'BINPUT', 'BINSTRING', 'BINUNICODE', 'BUILD', 
'BufferType', 'BuiltinFunctionType', 'BuiltinMethodType', 'ClassType', 
'CodeType', 'ComplexType', 'DICT', 'DUP', 'DictProxyType', 'DictType', 
'DictionaryType', 'EMPTY_DICT', 'EMPTY_LIST', 'EMPTY_TUPLE', 
'EllipsisType', 'FLOAT', 'FileType', 'FloatType', 'FrameType', 
'FunctionType', 'GET', 'GLOBAL', 'GeneratorType', 'INST', 'INT', 
'InstanceType', 'IntType', 'LIST', 'LONG', 'LONG_BINGET', 'LONG_BINPUT', 
'LambdaType', 'ListType', 'LongType', 'MARK', 'MethodType', 
'ModuleType', 'NONE', 'NoneType', 'OBJ', 'ObjectType', 'PERSID', 'POP', 
'POP_MARK', 'PUT', 'PickleError', 'Pickler', 'PicklingError', 
'PyStringMap', 'REDUCE', 'SETITEM', 'SETITEMS', 'SHORT_BINSTRING', 
'STOP', 'STRING', 'SliceType', 'StringType', 'StringTypes', 'TUPLE', 
'TracebackType', 'TupleType', 'TypeType', 'UNICODE', 
'UnboundMethodType', 'UnicodeType', 'Unpickler', 'UnpicklingError', 
'XRangeType', '_EmptyClass', '_Stop', '__all__', '__builtins__', 
'__doc__', '__file__', '__name__', '__version__', '_keep_alive', 
'classmap', 'compatible_formats', 'dispatch_table', 'format_version', 
'marshal', 'mdumps', 'mloads', 're', 'safe_constructors', 'struct', 
'sys', 'whichmodule', 'x']

I find this extremely strange.
What could be going on here?

Thanks in advance,

   Bram Stolk





More information about the Python-list mailing list