pickle unable to load collection

Terry Reedy tjreedy at udel.edu
Tue May 18 13:07:00 EDT 2010


On 5/18/2010 3:10 AM, Peter Otten wrote:
> Now simulate the effect of writing in text mode and reading in binary mode:
>
>>>> >>>  garbled_data = data.replace("\n", "\r\n")
>>>> >>>  pickle.loads(garbled_data)
> Traceback (most recent call last):
...
> ImportError: No module named collections
>
>>>> >>>  try: pickle.loads(garbled_data)
> ... except ImportError as e:
> ...     e
> ...
> ImportError('No module named collections\r',)

Nice catch, Peter. I filed a request that the message quote the name it 
cannot import, so that the OP would have seen the more informative

ImportError: No module named 'collections\r'

http://bugs.python.org/issue8754

Terry Jan Reedy





More information about the Python-list mailing list