Issue 13457: Use repr(module name) ImportErrors (original) (raw)

Issue13457

Created on 2011-11-22 20:28 by cool-RR, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg148140 - (view) Author: Ram Rachum (cool-RR) * Date: 2011-11-22 20:28
Recently I was confronted with a mysterious error: ImportError: No module named datetime Firther investigation revealed that the cause was a pickling problem that ran `__import__('datetime\r')`. If `ImportError` would have shown the module name as a string, there would be no ambiguity: ImportError: No module named 'datetime\r'
msg148141 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2011-11-22 20:32
3.3 will be adding an attribute which would have "datetime\r" here. See #1559549, which might make this a duplicate. You shouldn't (have to) rely on parsing the exception string.
msg148401 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-26 13:24
__import__ and importlib in Python 3.3 already use repr (see c4361bab6914 and 9f9b7b656761): Traceback (most recent call last): File "", line 1, in ImportError: No module named 'string\n' For other stdlib modules, see #8754.
History
Date User Action Args
2022-04-11 14:57:24 admin set github: 57666
2011-11-27 00:11:53 eric.snow set nosy: + eric.snow
2011-11-26 13:24:08 eric.araujo set nosy: + eric.araujotitle: Display module name as string in `ImportError` -> Use repr(module name) ImportErrorsmessages: + resolution: out of datestage: resolved
2011-11-22 20:34:14 cool-RR set status: open -> closed
2011-11-22 20:32:22 brian.curtin set nosy: + brian.curtinmessages: +
2011-11-22 20:29:04 cool-RR set type: behavior
2011-11-22 20:28:55 cool-RR create