On Wed, 30 Jun 2010 03:35:10 pm Andrew Martin wrote: > I just downloaded Python 2.6.5 onto my windows vista laptop. I am > attempting to install "escript version 3: Solution of Partial > Differential Equations (PDE) using Finite Elements (FEM)." I > downloaded the files and manually placed them in their appropriately > place on my computer according to the > ReadMe file. However, when I try to import escript, I get an error: > >>> import esys.escript > > Traceback (most recent call last): > File "<pyshell#0>", line 1, in <module> > import esys.escript > ImportError: Bad magic number in > C:\Python26\lib\site-packages\esys\escript\__init__.pyc
Is it possible that esys only provides compiled .pyc files, and that for a different version of Python? If the .py file (source code) is there, Python *should* automatically delete the .pyc file (byte code) and re-compile it from the .py file. But if there is no .py file, then Python is stuck with using only the pre-compiled .pyc file, but it needs to have been compiled for the same version of Python. You can't have Python 2.6 run a .pyc file from 2.5 or 3.1 (say). The "magic number" is there to declare the version of Python used. -- Steven D'Aprano _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor