[Python-Dev] ImportWarning flood
Jean-Paul Calderone
exarkun at divmod.com
Sat Jun 24 17:03:11 CEST 2006
On Sat, 24 Jun 2006 07:27:15 -0700, Aahz <aahz at pythoncraft.com> wrote:
>On Sat, Jun 24, 2006, Jean-Paul Calderone wrote:
>>
>> I am very unhappy that the burden of understanding Python's package
>> structure is being pushed onto end users in this way. Several of my
>> projects now emit three or four warnings on import now.
>>
>> The Twisted plugin system relies on the fact that directories without
>> __init__ are not Python packages (since they _aren't_, have never
>> been, and it has always been extremely clear that Python will ignore
>> them).
>>
>> Of course, Twisted is a pretty marginal Python user so I'm sure no one
>> cares.
>
>Then again, bringing this back to the original source of this change,
>Google is a pretty marginal Python user, too. ;-)
I think it is safe to say that Twisted is more widely used than anything
Google has yet released. Twisted also has a reasonably plausible
technical reason to dislike this change. Google has a bunch of engineers
who, apparently, cannot remember to create an empty __init__.py file in
some directories sometimes.
>
>I was a pretty strong -1 on the original proposed change of allowing
>import on empty directories, but my take is that if a project
>deliberately includes empty directories, they can add a new warning
>filter on program startup. Your users will have to upgrade to a new
>version of the application or do a similar fix in their own
>sitecustomize. I don't consider that a huge burden.
The usage here precludes fixing it in Twisted. Importing twisted itself prints a warning: there's no way to get code run soon enough to suppress
this.
I do think requiring each user to modify sitecustomize is overly
burdensome. Of course this is highly subjective and I don't expect
anyone to come to an agreement over it, but it seems clear that it is
at least a burden of some sort.
Jean-Paul
More information about the Python-Dev
mailing list