--- "Martin v. L�wis" <[EMAIL PROTECTED]> wrote: > Ralf W. Grosse-Kunstleve wrote: > > If there is a consenus, I'd create a new exception > ImportErrorNoModule(name) > > that is used consistently from all places. This would ensure uniformity of > the > > message in the future. > > A correction proposal should only be given if it is likely correct.
It is not a proposal, just a "note". Maybe a better alternative would be ImportError: No module name foo Reminder: To resolve import problems consult the section on "Packages" at http://www.python.org/doc/tut/ > There can be many reasons why an import could fail: there might be > no read permission for the file, The warning in 2.5b1 doesn't fire in this case: % ls -l junk.py ---------- 1 rwgk cci 16 Jun 28 05:01 junk.py % python Python 2.5b1 (r25b1:47027, Jun 26 2006, 02:59:25) [GCC 4.1.0 20060304 (Red Hat 4.1.0-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import junk Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named junk >>> > or the PYTHONPATH might be setup > incorrectly. That's impossible to detect. > IOW, a hint about a missing __init__.py should only be given if > a directory with the name of module was found, but lacked an > __init__.py (i.e. in the cases where currently a warning is > produced). I am thinking you'd need to build up a buffer of potential warnings while trying to resolve an import. If the import succeeds the buffer is discarded, if it fails it is added to the exception message, or the warnings are "flushed" right before the ImportError is raised. Does that sound right? How would this interact with threading (it seems you'd need a separate buffer for each thread)? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com