tags:

views:

123

answers:

1

Hello,

I use one c++ dll in my python code. When I run my python app on my computer, it works fine but when I copy all to another computer this happen:

Traceback (most recent call last):
 File "C:\users\Public\SoundLog\Code\Código Python\SoundLog\SoundLog.py", line 9, in <module>
   from Auxiliar import *
 File "C:\users\Public\SoundLog\Code\Código Python\SoundLog\Auxiliar\DataCollection.py", line 4, in <module>
   import SoundLogDLL
 File "C:\users\Public\SoundLog\Code\Código Python\SoundLog\Auxiliar\SoundLogDLL.py", line 4, in <module>
   dll = cdll.LoadLibrary(os.environ['PUBLIC'] + "\\SoundLog\\DLLs\\ForPython\\SoundLogC++WrapperDLL.dll")
 File "C:\Python26\lib\ctypes\__init__.py", line 431, in LoadLibrary
   return self._dlltype(name)
 File "C:\Python26\lib\ctypes\__init__.py", line 353, in __init__
   self._handle = _dlopen(self._name, mode)
WindowsError: [Error 14001] The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail

How can I fix this problem so that my python app work in every computer?

Note: I only need them to work on windows 7 like mine. And I tested on another win7 computer (both 32bits).

+2  A: 

You're using a DLL which depends on a Microsoft Visual C++ runtime which isn't installed on the target computer. You have a few options:

  • Install or copy the Visual C++ runtime libraries to the target computer. Installation is done by adding merge modules to your installer (if you have one) or by running the redistributable installer (vcredist.exe). The various methods are documented here for VS2005 (other versions will be similar).

  • If you built the DLL, you can change the project settings to statically link the runtime libraries. See this answer to see how this is done.

interjay
Specifically, the ctypes library. I'm not sure how much Windows supports it.
Bryan Ross
@Bryan: Windows supports the ctypes library just fine. The error here was not caused by ctypes, but by a DLL which happened to have been loaded using ctypes.
interjay
I've done it installing the Visual C++ runtime libraries and changing the execution of the project from Debug to Release ^^
aF