Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:not': 0.03; 'subject:file': 0.07; 'sys': 0.07; 'cc:addr:python-list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'imports': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'source': 0.25; 'somewhere': 0.26; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'anyone': 0.31; 'this.': 0.32; 'received:google.com': 0.35; 'doing': 0.36; 'so,': 0.37; 'pm,': 0.38; 'explain': 0.39; 'itself': 0.39; 'how': 0.40; 'skip:u 10': 0.60; 'first': 0.61; 'jul': 0.74; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=P1MJfOv4nDfiX3tq8155cQOd6mC58YoBdQLKq7xTa+M=; b=JJK2+PNTkzMSoQSYQYcKtyTJTO+OZ7FzgrYwJTP612rGOVwq5Doy7QF6WIRIKnN09T Ur9bB0dBWXAuSOClt3xRtJv3iLT848bANZsKWUsnM1dawnwL2Wps9ZSWEA280B6zJ0AH WqpuQKRtSIHlA4CTW5e/05JboCLbqAdh3WOkTbJGKyh5LASHqQqkD/hC2nO2n0EcThaT RB4lZeGwyEE9r3UUR46XErJAvq+UFeRZgGttkGObLffaQcNohSi311hj9tq5VGfpebjP VO9dYMP6n20hJtLMZLw/STw1qrcQi/lOddT/2An2iADbrk3wZa+OcPlv9ovgmOo/Lbo0 WQ+g== MIME-Version: 1.0 X-Received: by 10.221.47.9 with SMTP id uq9mr1364795vcb.48.1404720276566; Mon, 07 Jul 2014 01:04:36 -0700 (PDT) In-Reply-To: <53ba52e1$0$2926$c3e8da3$76491128@news.astraweb.com> References: <53ba52e1$0$2926$c3e8da3$76491128@news.astraweb.com> Date: Mon, 7 Jul 2014 18:04:36 +1000 Subject: Re: Module name does not match file name From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404720285 news.xs4all.nl 2838 [2001:888:2000:d::a6]:42642 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74083 On Mon, Jul 7, 2014 at 5:57 PM, Steven D'Aprano 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. # importme.py import sys sys.modules["importme"]=sys >>> import importme >>> importme Unfortunately, that doesn't help much with actually finding the source code that's doing this. ChrisA