Bad Magic Number with only .py deployed

KronicDeth Kronic.Deth at gmail.com
Thu Oct 19 16:49:01 CEST 2006


I have a package of python modules deployed on an NFS mount on my
network that I use for sysadmin tools.   Since some of the machines use
different versions of python I've only put the .py files in the mounted
share.  However, I'm getting ImportError: Bad Magic Number when I try
to load any of the modules from the mount point.  All the discussions I
can find say that a bad magic number should only occur with a
mismatched interpreter and compiled .pyc, but all that's deployed is
the .py.  This should mean that any scripts that load the modules will
compile on import and so the interpreter should always be the same, but
that doesn't seem to be the case.  Could this be a permission issue?
Does the interpreter panic and say Bad Magic Number if it can't write
to the same location as the .py files are?  There are only 3 versions
of python on the network, but I'd rather not have to compile against
each.  Actually, I just tried it again and /usr/bin/python, which is
2.3.3 imports the top level module fine, but one of the network mounted
version, which is 2.5, gives the Bad Magic Number problem on
lib/__init__.py.  Neither of the intrepreters should be writing the
.pyc, so I don't see how they can get a Bad Magic Number from their own
stuff.




More information about the Python-list mailing list