[ python-Bugs-1515169 ] ImportWarning should be removed
SourceForge.net
noreply at sourceforge.net
Fri Jun 30 16:42:56 CEST 2006
Bugs item #1515169, was opened at 2006-06-30 10:42
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1515169&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: James Y Knight (foom)
Assigned to: Nobody/Anonymous (nobody)
Summary: ImportWarning should be removed
Initial Comment:
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.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1515169&group_id=5470
More information about the Python-bugs-list
mailing list