[issue20794] ImportError: Bad magic number in .pyc file
Peter Otten
report at bugs.python.org
Thu Feb 27 14:22:03 CET 2014
Peter Otten added the comment:
This is expected. You cannot run/import 2.6 .pyc files in python 2.7 because the file format has changed.
$ echo 'print "hello"' > tmp.py
$ python2.6 -c 'import tmp'
hello
$ rm tmp.py
$ python2.7 -c 'import tmp'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: Bad magic number in tmp.pyc
Naval, if you do have the source xxxx.py make sure that you delete all occurrences of xxxx.pyc in directories preceding the directory containing xxxx.py in sys.path. Sometimes this error is the result of moving a .py file into another directory and forgetting to delete the leftover .pyc.
----------
nosy: +peter.otten
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20794>
_______________________________________
More information about the Python-bugs-list
mailing list