views:

87

answers:

3

Hello, I used python 2.5 and imported a file named "irit.py" from C:\util\Python25\Lib\site-packages directory. This files imports the file "_irit.pyc which is in the same directory. It worked well and did what I wanted. Than, I tried the same thing with python version 2.6.4. "irit.py" which is in C:\util\Python26\Lib\site-packages was imported, but "_irit.pyc" (which is in the same directory of 26, like before) hasn't been found. I got the error message:

File "C:\util\Python26\lib\site-packages\irit.py", line 5, in import _irit ImportError: DLL load failed: The specified module could not be found.

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

+5  A: 

"DLL load failed" can't directly refer to the .pyc, since that's a bytecode file, not a DLL; a DLL would be .pyd on Windows. So presumably that _irit.pyc bytecode file tries to import some .pyd and that .pyd is not available in a 2.6-compatible version in the appropriate directory. Unfortunately it also appears that the source file _irit.py isn't around either, so the error messages end up less informative that they could be. I'd try to run python -v, which gives verbose messages on all module loading and unloading actions -- maybe that will let you infer the name of the missing .pyd when you compare its behavior in 2.5 and 2.6.

Alex Martelli
+1  A: 

Pyc files are not guaranteed to be compatible across python versions, so even if you fix the missing dll, you could still run in to problems.

mikerobi
A: 

Hello and thanks for responding,

The py and pyd files are at in the C:\util\Python26\Lib\site-packages directory and and I put the pyd file in C:\util\Python26\DLLs too because it is a Dll. Still I get the message:

Traceback (most recent call last): File "adap_iso.py", line 7, in import irit File "C:\util\Python26\lib\site-packages\irit.py", line 5, in import _irit ImportError: DLL load failed: The specified module could not be found.

My pathes are:

PYTHONHOME=C:\util\Python26 PYTHONPATH=C:\util\Python26; C:\util\Python26\DLLs

so realy don't understand what can be the problem, and why It is not finding the DLL file? (I suppose the meaning in DLL file is too _irit.pyd file)

While I ran python -v I got:

C:\Almog>python -v adap_iso.py

installing zipimport hook

import zipimport # builtin

installed zipimport hook

C:\util\Python26\lib\site.pyc matches C:\util\Python26\lib\site.py

import site # precompiled from C:\util\Python26\lib\site.pyc

C:\util\Python26\lib\os.pyc matches C:\util\Python26\lib\os.py

import os # precompiled from C:\util\Python26\lib\os.pyc import errno # builtin import nt # builtin

C:\util\Python26\lib\ntpath.pyc matches C:\util\Python26\lib\ntpath.py

import ntpath # precompiled from C:\util\Python26\lib\ntpath.pyc

C:\util\Python26\lib\stat.pyc matches C:\util\Python26\lib\stat.py

import stat # precompiled from C:\util\Python26\lib\stat.pyc

C:\util\Python26\lib\genericpath.pyc matches C:\util\Python26\lib\genericpath.

py import genericpath # precompiled from C:\util\Python26\lib\genericpath.pyc

C:\util\Python26\lib\warnings.pyc matches C:\util\Python26\lib\warnings.py

import warnings # precompiled from C:\util\Python26\lib\warnings.pyc

C:\util\Python26\lib\linecache.pyc matches C:\util\Python26\lib\linecache.py

import linecache # precompiled from C:\util\Python26\lib\linecache.pyc

C:\util\Python26\lib\types.pyc matches C:\util\Python26\lib\types.py

import types # precompiled from C:\util\Python26\lib\types.pyc

C:\util\Python26\lib\UserDict.pyc matches C:\util\Python26\lib\UserDict.py

import UserDict # precompiled from C:\util\Python26\lib\UserDict.pyc

C:\util\Python26\lib_abcoll.pyc matches C:\util\Python26\lib_abcoll.py

import _abcoll # precompiled from C:\util\Python26\lib_abcoll.pyc

C:\util\Python26\lib\abc.pyc matches C:\util\Python26\lib\abc.py

import abc # precompiled from C:\util\Python26\lib\abc.pyc

C:\util\Python26\lib\copy_reg.pyc matches C:\util\Python26\lib\copy_reg.py

import copy_reg # precompiled from C:\util\Python26\lib\copy_reg.pyc

C:\util\Python26\lib\locale.pyc matches C:\util\Python26\lib\locale.py

import locale # precompiled from C:\util\Python26\lib\locale.pyc import encodings # directory C:\util\Python26\lib\encodings

C:\util\Python26\lib\encodings_init_.pyc matches C:\util\Python26\lib\encod

ings_init_.py import encodings # precompiled from C:\util\Python26\lib\encodings_init_.pyc

C:\util\Python26\lib\codecs.pyc matches C:\util\Python26\lib\codecs.py

import codecs # precompiled from C:\util\Python26\lib\codecs.pyc import _codecs # builtin

C:\util\Python26\lib\encodings\aliases.pyc matches C:\util\Python26\lib\encodi

ngs\aliases.py import encodings.aliases # precompiled from C:\util\Python26\lib\encodings\alias es.pyc

C:\util\Python26\lib\functools.pyc matches C:\util\Python26\lib\functools.py

import functools # precompiled from C:\util\Python26\lib\functools.pyc import _functools # builtin import _locale # builtin

C:\util\Python26\lib\re.pyc matches C:\util\Python26\lib\re.py

import re # precompiled from C:\util\Python26\lib\re.pyc

C:\util\Python26\lib\sre_compile.pyc matches C:\util\Python26\lib\sre_compile.

py import sre_compile # precompiled from C:\util\Python26\lib\sre_compile.pyc import _sre # builtin

C:\util\Python26\lib\sre_parse.pyc matches C:\util\Python26\lib\sre_parse.py

import sre_parse # precompiled from C:\util\Python26\lib\sre_parse.pyc

C:\util\Python26\lib\sre_constants.pyc matches C:\util\Python26\lib\sre_consta

nts.py import sre_constants # precompiled from C:\util\Python26\lib\sre_constants.pyc import operator # builtin

C:\util\Python26\lib\encodings\cp1255.pyc matches C:\util\Python26\lib\encodin

gs\cp1255.py import encodings.cp1255 # precompiled from C:\util\Python26\lib\encodings\cp1255 .pyc Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. import math # builtin

C:\util\Python26\lib\site-packages\irit.pyc matches C:\util\Python26\lib\site-

packages\irit.py import irit # precompiled from C:\util\Python26\lib\site-packages\irit.pyc Traceback (most recent call last): File "adap_iso.py", line 7, in import irit File "C:\util\Python26\lib\site-packages\irit.py", line 5, in import _irit ImportError: DLL load failed: The specified module could not be found.

clear builtin._

clear sys.path

clear sys.argv

clear sys.ps1

clear sys.ps2

clear sys.exitfunc

clear sys.exc_type

clear sys.exc_value

clear sys.exc_traceback

clear sys.last_type

clear sys.last_value

clear sys.last_traceback

clear sys.path_hooks

clear sys.path_importer_cache

clear sys.meta_path

clear sys.flags

clear sys.float_info

restore sys.stdin

restore sys.stdout

restore sys.stderr

cleanup main

cleanup[1] locale

cleanup[1] functools

cleanup[1] encodings

cleanup[1] site

cleanup[1] operator

cleanup[1] abc

cleanup[1] sre_constants

cleanup[1] re

cleanup[1] _codecs

cleanup[1] nt

cleanup[1] _warnings

cleanup[1] math

cleanup[1] zipimport

cleanup[1] _functools

cleanup[1] _locale

cleanup[1] signal

cleanup[1] encodings.aliases

cleanup[1] exceptions

cleanup[1] encodings.cp1255

cleanup[1] sre_compile

cleanup[1] _sre

cleanup[1] codecs

cleanup[1] sre_parse

cleanup[2] copy_reg

cleanup[2] types

cleanup[2] errno

cleanup[2] _abcoll

cleanup[2] ntpath

cleanup[2] genericpath

cleanup[2] stat

cleanup[2] warnings

cleanup[2] UserDict

cleanup[2] os.path

cleanup[2] linecache

cleanup[2] os

cleanup sys

cleanup builtin

cleanup ints: 19 unfreed ints

cleanup floats

Any suggestions??

Thanks!

almogavr