Issue 1515169: ImportWarning should be removed (original) (raw)
Issue1515169
Created on 2006-06-30 14:42 by foom, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (3) | ||
---|---|---|
msg29004 - (view) | Author: James Y Knight (foom) | Date: 2006-06-30 14:42 |
As discussed in email thread: http://www.gossamer-threads.com/lists/python/dev/497487 In particular, there are three specific reasons for not having it. I expect these reasons to translate to a larger number of specific reasons as more people use python 2.5. 1) Ralf's software gets a flood of ImportWarnings 2) Twisted's plugin system uses a directory named "twisted" without an __init__.py in it on the python path to store plugins in. Therefore, anybody running (importing) twisted will produce annoying warnings. 3) I have a directory in my homedir called "readline". Quoted from my email: I just found another reason to dislike the warnings: my homedir on one machine has a lot of random directories in it. One of them is named "readline". Every time I run python 2.5, it now helpfully notes: sys:1: ImportWarning: Not importing directory 'readline': missing __init__.py It used to be the case that it was very unlikely that running python in your homedir would cause issues. Even though the current directory is on the default pythonpath, you needed to have either a file ending in .py or a directory with an __init__.py with the same name as a python module to cause problems. And that is generally unlikely to happen. Now, however, you get warnings just by having _any_ directory in your CWD with the same name as a python module. That's much more likely to happen; I can't be the only one who will have this issue. Suggested solution: Remove ImportWarning, and make the ImportError message say: >> ImportError: No module named mypackage.foo >> Note that subdirectories are searched for imports only if they contain an >> __init__.py file: http://www.python.org/doc/essays/packages.html I really think this should be addressed before 2.5 is released. | ||
msg29005 - (view) | Author: Shane Hathaway (hathawsh) | Date: 2006-06-30 23:17 |
Logged In: YES user_id=16701 I have submitted a patch (#1515361) that causes find_module() to only generate these warnings if the import fails. | ||
msg29006 - (view) | Author: Neal Norwitz (nnorwitz) * ![]() |
Date: 2006-07-10 01:11 |
Logged In: YES user_id=33168 The warning is now off by default. The behaviour will be revisited for 2.6. See PEP 361 for 2.6. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:18 | admin | set | github: 43589 |
2006-06-30 14:42:56 | foom | create |