Author terry.reedy
Recipients terry.reedy
Date 2010-05-18.17:03:17
SpamBayes Score 4.90426e-07
Marked as misclassified No
Message-id <1274202200.16.0.392487565261.issue8754@psf.upfronthosting.co.za>
In-reply-to
Content
ImportError messages should quote the name it cannot import since the actual problem may be whitespace in the name that is currently invisible in the message.  In other words, display

ImportError: no module named 'bad name\r'

instead of

ImportError: no module named bad name

This defect lead to the current python-list thread
  pickle unable to load collection

Peter Otten figured out that it was unable to load 'collections\r' rather than 'collections', which he demonstrated with

>>> >>> try: pickle.loads(garbled_data)
... except ImportError as e:
...     e
...
ImportError('No module named collections\r',)

The OP used 2.6, I tested 3.1, hence presume, after searching tracker issues, that this applies to 2.7 and 3.2 as well.

I marked this as a bug since the current message is wrong and misleading. I suspect the same may be true of a few other error messages, but I cannot think of any at the moment.
History
Date User Action Args
2010-05-18 17:03:20terry.reedysetrecipients: + terry.reedy
2010-05-18 17:03:20terry.reedysetmessageid: <1274202200.16.0.392487565261.issue8754@psf.upfronthosting.co.za>
2010-05-18 17:03:18terry.reedylinkissue8754 messages
2010-05-18 17:03:17terry.reedycreate