Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; "subject:' ": 0.07; 'dan': 0.09; 'django,': 0.09; 'restart': 0.09; 'seen,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'assume': 0.14; '.py': 0.16; 'cached': 0.16; 'cc:name:python list': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'internals,': 0.16; 'subject:object': 0.16; 'wrote:': 0.18; 'module': 0.19; 'file,': 0.19; 'mechanism': 0.19; 'version.': 0.19; 'seems': 0.21; 'import': 0.22; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'load': 0.23; 'versions': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'getting': 0.31; 'safely': 0.31; 'anyone': 0.31; 'me?': 0.32; 'running': 0.33; 'fri,': 0.33; 'updated': 0.34; 'something': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'really': 0.36; 'doing': 0.36; 'method': 0.36; 'wrong': 0.37; 'being': 0.38; 'files': 0.38; 'rather': 0.38; 'that,': 0.38; 'new': 0.61; 'risk': 0.72; 'jul': 0.74; 'subject:skip:A 10': 0.78; '"hey,': 0.84; 'again?': 0.84; 'subject:Solution': 0.84; 'wipe': 0.84; '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=1d2wMdZZFf+UxYnV3HFusuS/x38AFycAQItzVSxdVHg=; b=qJPxJQN9oI3FcVOTzmB20Z/eK5yiqNJsyplrSPjfU3SnxqQTmT+e1ef6S+Oc683BTj oHQOVBRBdJk7xFhfZ2QZwKjDXMNvrzwV5zRm5mOChNanvmNDVBQhvi+T6H7HlBMGLIRx cMi+kt/r4TbX8aib6tVmgqrfeA7Tt4VTGt5mRQXRYmcbbN4y9yzEALxcA52XmRJM0HPq MNTULtfsHq7pCcxWGWqJUp73HbsHpoiff4/sLZtZ55qDrP5rHCYkkyrJpmE8XmxrmTiq fxHGNiQYOy9Jt8EgGTLqoYCYnwgWJDHSUF4vDBRTIw4je3YG646XvEhHSBtEXQos+3F0 Xdlw== MIME-Version: 1.0 X-Received: by 10.52.82.166 with SMTP id j6mr607223vdy.87.1405011484451; Thu, 10 Jul 2014 09:58:04 -0700 (PDT) In-Reply-To: References: Date: Fri, 11 Jul 2014 02:58:04 +1000 Subject: Re: Solution-resistant AttributeError: 'modle' object has no attribute... From: Chris Angelico Cc: Python List 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1405011487 news.xs4all.nl 2853 [2001:888:2000:d::a6]:60631 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74317 On Fri, Jul 11, 2014 at 2:41 AM, Dan Stromberg wrote: > It's as though an old version of the module is being > seen, rather than the current version. > > Anyone have any (further) suggestions for me? > Wipe out *.pyc and try again? Restart any processes that are running Django, in case they have it cached in memory? This is something Python isn't really designed for (coping with multiple versions of a module simultaneously). The Python import machinery seems to assume that, across one process's lifetime, all .py and .pyc (etc) files ever used will remain pristine, and can safely be cached etc. There's no good mechanism for saying "Hey, Python, I just updated this file, can you load the new version please?" - every method I've seen for doing so seems to require fiddling around with internals, and/or extreme risk of getting the wrong version. ChrisA