Module name does not match file name

Chris Angelico rosuav at gmail.com
Mon Jul 7 11:11:52 CEST 2014


On Mon, Jul 7, 2014 at 7:03 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Mon, 07 Jul 2014 18:04:36 +1000, Chris Angelico wrote:
>
>> On Mon, Jul 7, 2014 at 5:57 PM, Steven D'Aprano <steve at pearwood.info>
>> wrote:
>>> Can anyone explain how "import pg" can end up coming from pgmodule.so?
>>
>> First guess: There's a "pg.py" somewhere that imports the so, then
>> replaces itself in sys.modules.
>
>
> Oh, there's a pg.py somewhere alright, but it imports _py and there is no
> _py module anywhere on the system. I don't believe that the pg.py file is
> actually used, even though it is in the site-packages next to pgmodule.py.

Huh. Definitely curious as to what 'python -v' says, then.

> I did mention the maze of twisty dependencies, didn't I?

And I winced at your opening paragraph.

ChrisA



More information about the Python-list mailing list