[Python-ideas] Idea: Importing from arbitrary filenames

Eric Fahlgren ericfahlgren at gmail.com
Mon Apr 16 14:23:26 EDT 2018


On Mon, Apr 16, 2018 at 10:23 AM, Brett Cannon <brett at python.org> wrote:

>
>
> On Mon, 16 Apr 2018 at 09:58 Eric Fahlgren <ericfahlgren at gmail.com> wrote:
>
>> The documentation is pretty opaque or non-existent on other aspects of
>> importlib use, too.
>>
>
> Well, we are diving into the dark corners of import here. (Details can be
> found in the language reference: https://docs.python.org/3/
> reference/import.html)
>

Thanks, Brett, I'll read through that and see where I get.  Those corners
/are/ pretty dark.

The backstory is that I'm doing the final port from Py2 to Py3 (it's been a
long time coming, mostly years of waiting for extension modules to get
ported, notably wxPython and VTK).  In Py2, all warnings were enabled and
disallowed, so big surprise on first run, hundreds of lines of the
aforementioned one and "ImportWarning: __package__ != __spec__.parent".  We
have manually defined "__package__" all over the place, for reasons lost in
the fog of time, which I believe to be the culprit for the latter warning.

Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180416/bf54cfa4/attachment-0001.html>


More information about the Python-ideas mailing list