Solution-resistant AttributeError: 'modle' object has no attribute...

Chris Angelico rosuav at gmail.com
Thu Jul 10 12:58:04 EDT 2014


On Fri, Jul 11, 2014 at 2:41 AM, Dan Stromberg <drsalists at gmail.com> 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



More information about the Python-list mailing list