Issue 18598: Importlib, more verbosity please (original) (raw)
Issue18598
Created on 2013-07-30 10:30 by Lukáš.Němec, last changed 2022-04-11 14:57 by admin. This issue is now closed.
Messages (6) | ||
---|---|---|
msg193922 - (view) | Author: Lukáš Němec (Lukáš.Němec) | Date: 2013-07-30 10:30 |
Hello, recently I filed this bugreport to Django, but they clarified this by pointing me to commits for new version of Django that uses python builtin importlib (import_module) But since most of their import_module code is done like [import_module(x) for y if blahblah], it is very difficult for me to debug code where Django tries to import some package, and all I get back is message "relative imports require the 'package' argument" This message tells me exactly nothing :), just that something somewhere, even 3rd party app tried to do relative imports ... what did it import, with what parameters? I edited this locally for debugging, and changed it to this: "relative imports require the 'package' argument, package: %s" % name This simple change of the message allowed me to find the problem in a few seconds.. Would you please consider adding something similar to importlib for better debugging? Thank you :) | ||
msg193925 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2013-07-30 12:43 |
It could be changed to something like "the 'package' argument is required to perform a relative import for {!r}".format(name) . Would that have made it more clear? | ||
msg193926 - (view) | Author: Lukáš Němec (Lukáš.Němec) | Date: 2013-07-30 12:45 |
Yes, absolutely, that is what was I needed to debug it easily, the name parameter Thank you :) | ||
msg193927 - (view) | Author: Lukáš Němec (Lukáš.Němec) | Date: 2013-07-30 12:46 |
Also, please do not forget on backports for python 2.6+ :) | ||
msg193933 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2013-07-30 13:34 |
Sorry, I can't backport this change as it's not a bugfix but an enhancement and it could break someone's code who relies on the specific format of the exception message. | ||
msg194973 - (view) | Author: Roundup Robot (python-dev) ![]() |
Date: 2013-08-12 17:29 |
New changeset 2294594fbe6c by Brett Cannon in branch 'default': Closes issue #18598: Have the exception message for http://hg.python.org/cpython/rev/2294594fbe6c |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:57:48 | admin | set | github: 62798 |
2013-08-12 17:29:45 | brett.cannon | set | status: open -> closedresolution: fixedstage: needs patch -> resolved |
2013-08-12 17:29:21 | python-dev | set | nosy: + python-devmessages: + |
2013-07-30 13:34:00 | brett.cannon | set | messages: + |
2013-07-30 12:46:17 | Lukáš.Němec | set | messages: + |
2013-07-30 12:45:14 | Lukáš.Němec | set | messages: + |
2013-07-30 12:43:37 | brett.cannon | set | priority: normal -> lowassignee: brett.cannonversions: + Python 3.4nosy: + brett.cannonmessages: + stage: needs patch |
2013-07-30 10:30:44 | Lukáš.Němec | create |