[Python-Dev] ImportError message suggestion (original) (raw)
Matt Giuca matt.giuca at gmail.com
Tue Aug 19 19:04:37 CEST 2008
- Previous message: [Python-Dev] ImportError message suggestion
- Next message: [Python-Dev] ImportError message suggestion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ImportError: cannot import name annotate from /usr//image.pyc
That could be handy.
Not sure it's necessary, however, and exposes some system information in the error message. I can imagine a web app which prints out exception messages, and this would mean the server file structure is printed to the world (though arguably you should not be doing this on your web app, I work on an open source web app and we do dump tracebacks to our users sometimes -- because it's open source we don't mind them seeing the code -- but we'd rather not have them see our server details).
If you do get this issue (as a developer), I find the built-in help() function very handy -- you can import a module then go help(that_module) and it tells you the absolute path to the module. That might be a sufficient alternative to this patch (though requiring a bit more manual labour).
So I am neither for nor against this suggestion.
"I think the acceptance for this wouldn't be that hard since there is
no real issue for regression (the only one I could think of is for doctest module, although I'm not sure there are any reason to test for failed import in doctest)"
I agree. (I'm more familiar with unittest than doctest, where you'd just use assertRaises(ImportError, ...) and not care what the exception message is -- is there any way in doctest to check for the exception type without caring about the message?)
I can't write the C code myself, or evaluate the patch.
Go to http://bugs.python.org/ and add a new issue. Upload the patch as an attachment when you enter the issue description. I think you'll have to put it down as a feature request for 2.7/3.1, since the beta tomorrow will mean no more features in 2.6/3.0.
Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20080820/cd42b4b0/attachment.htm>
- Previous message: [Python-Dev] ImportError message suggestion
- Next message: [Python-Dev] ImportError message suggestion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]