How can I import a * .pyc file from another version of python?

I used python 2.5 and imported a file called "irit.py" from the C: \ util \ Python25 \ Lib \ site-packages directory. These files will import the "_irit.pyc" file located in the same directory. He worked well and did what I wanted. Than, I tried the same with python version 2.6.4. "irit.py" which is located in the C: \ util \ Python26 \ Lib \ site-packages folder was imported, but "_irit.pyc" (which is in the same directory out of 26 as before) was not found. I got the error:

File "C: \ util \ Python26 \ lib \ site-packages \ irit.py", line 5, in import _irit ImportError: Error loading DLL: The specified module was not found.

Can someone help me understand the problem and how to fix it? Thank you, Almog.

+2


a source to share


2 answers


"DLL Load Error" cannot be directly referenced .pyc

as it is a bytecode file and not a DLL; DLL will be .pyd

in Windows. So it is presumed that the _irit.pyc

bytecode file is trying to import some .pyd

and that is .pyd

not available in the 2.6-compatible version in the appropriate directory. Unfortunately, it also seems like the original file _irit.py

is not there either, so the error messages become less informative than they might be. I will try to run python -v

one that gives detailed messages about all the actions to load and unload modules - perhaps this will allow you to print the name of the missing one .pyd

when comparing its behavior in versions 2.5 and 2.6.



+5


a source


Pyc files are not guaranteed to be compatible between python versions, so even if you fix the missing dll, you can still run into problems.



+1


a source







All Articles