New submission from Naval Gupta:
Getting below compilation error:
ImportError: Bad magic number in .pyc
Ran a python abc.py module which is trying to import .pyc during compilation
Python Interpreter used to run: Python 2.7
Python pre-compiled file .pyc is compiled using Python
STINNER Victor added the comment:
Can you please attach your script and give the command you are typing to
reproduce the issue?
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20794
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,
Ned Deily added the comment:
As Peter notes, .pyc and .pyo files are in general not compatible across Python
versions. PEP 3147 was implemented in Python 3.2 to help avoid the problem you
are seeing by storing .pyc/.pyo files with version-specific filenames. For
Python 2, you need to be