[issue8754] ImportError: quote bad module name in message
Terry J. Reedy
report at bugs.python.org
Tue May 18 19:03:20 CEST 2010
New submission from Terry J. Reedy <tjreedy at udel.edu>:
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.
----------
components: Interpreter Core
messages: 105988
nosy: tjreedy
priority: normal
severity: normal
status: open
title: ImportError: quote bad module name in message
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8754>
_______________________________________
More information about the Python-bugs-list
mailing list