0

The Situation:

I mostly use MATLAB. I don't know Python at all, but a co-worker wrote a data acquisition program in it. My MATLAB work is on hold until I get this Python script running on my machine, but it crashes on run. I need to get this working, but the code has zero comments, and I can't afford to learn an entirely new language for this one thing.

I'm using Python 2.7.11, PyCharm 2016.1.2 Professional. I copy/pasted the folder from my co-worker's computer with the project in it, but it crashes when I try to run it on my machine. PyCharm doesn't find any errors before runtime. This is the error message:

File "C:\Users\mherunter\Desktop\LabTest\flask\lib\site-
packages\UniversalLibrary\UniversalLibrary.py", line 57, in <module>
cbw = ctypes.windll.cbw32 # open CBW32.DLL
File "c:\python27\Lib\ctypes\__init__.py", line 435, in __getattr__
dll = self._dlltype(name)
File "c:\python27\Lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found

What I Have Tried:

I looked at some other answers on here and read about a couple possible problems. I don't think that something like '\t' in a filepath is getting converted to a TAB character, since the code runs fine on a different machine. I'm not familiar with DLL's much, but it seems like the computer can't open CBW32.DLL. I searched my computer for it and the file doesn't show up.

I tried changing this to CBW64, since my machine is 64bit, but got the same error message. It's a 32bit installation of Python I think, platform.architecture() says 32bit.

I also tried this on a brand-new (first thing I did after taking it out of the box sort of new) computer, Windows 10. That didn't work, but I read that I might need to install a C++ compiler to get all of the necessary DLL's. Installled VS Community 2015 with Visual C++, but that didn't help either.

The last thing I've seen on here is rebuilding the DLL with \MT to make it stand alone. I tried looking for how do to this online, but didn't have a lot of luck. Can anyone either:

  1. Tell me precisely how to rebuild the DLL with \MT?

  2. Suggest another reason/fix for this problem?

halfer
  • 19,824
  • 17
  • 99
  • 186
hwm
  • 117
  • 7
  • Are you working with a 64bit Python installation or a 32bit Python installation? – JRajan May 04 '16 at 23:22
  • 1
    Possible duplicate of [WindowsError: \[Error 126\] when loading a DLL with ctypes](http://stackoverflow.com/questions/10411709/windowserror-error-126-when-loading-a-dll-with-ctypes) – skrrgwasme May 04 '16 at 23:24
  • 1
    or [WindowsError: \[Error 126\] The specified module could not be found](http://stackoverflow.com/q/1940578/2615940) – skrrgwasme May 04 '16 at 23:24
  • `platform.architecture()` returns `('32bit', 'WindowsPE')` I'm installing VS Community 2015 with Visual C++ to see if that changes anything. – hwm May 04 '16 at 23:33
  • No dice with the VS install, exactly the same error as before. I read the other answer beforehand, but `LoadLibrary` isn't being used here, so there's no file path for me to edit. I've tried looking up how to rebuild the DLL with \MT, but can't find much unfortunately. – hwm May 05 '16 at 00:23

1 Answers1

2

Well you can't load dll which doesn't exists on your computer.

cbw32.dll is part of I/O Library for Measurement Computing Data Acquisition Products

So you need to download and install it to get the DLL.

Another way is to search for it on the internet, but beware of fake DLLs, which could be malware.

Samuel
  • 3,631
  • 5
  • 37
  • 71