NMGRL / toupcam

Python interface to ToupCam Cameras
http://www.touptek.com/product/showproduct.php?lang=en&id=108
Apache License 2.0
26 stars 15 forks source link

Problem with sample code #5

Closed sashagaz closed 5 years ago

sashagaz commented 5 years ago

I am getting the error below when running the sample code:

File "C:\ProgramData\Anaconda3\lib\ctypes__init.py", line 356, in init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 is not a valid Win32 application

Here is my system description: Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32

jirhiker commented 5 years ago

does not appear to be related to the toupcam code. Are python and ctypes properly installed in your environment?

sashagaz commented 5 years ago

Yes I am using Python version 3.7.3 and ctypes version '1.1.0'. any tips or ideas would be much appreciated.

jirhiker commented 5 years ago

can you send more of the error trace?

Maybe try python 2.7

sashagaz commented 5 years ago

Here is the python version: Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32

below is the full error-trace: Traceback (most recent call last): File "capture_loop.py", line 18, in from camera import ToupCamCamera File "C:\Users\agazman\Downloads\toupcam-master\toupcam-master\camera.py", line 26, in from core import lib, TOUPCAM_EVENT_IMAGE, TOUPCAM_EVENT_STILLIMAGE, success, HToupCam File "C:\Users\agazman\Downloads\toupcam-master\toupcam-master\core.py", line 43, in lib = ctypes.windll.LoadLibrary(os.path.join(root, directory, name)) File "C:\ProgramData\Anaconda3\lib\ctypes__init__.py", line 434, in LoadLibrary return self._dlltype(name) File "C:\ProgramData\Anaconda3\lib\ctypes__init.py", line 356, in init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 is not a valid Win32 application

Do you think that its an issue with the Python version?

jirhiker commented 5 years ago

try downloading the updated dll from #3 move the downloaded toupcam.dll to toupcam/x86

jirhiker commented 5 years ago

i just updated the dll in the x86 directory. Pull the lastest commit and see if that works

sashagaz commented 5 years ago

Hey Jake, thanks for the help. I tried the new dll file and I am getting the same error: OSError: [WinError 193] %1 is not a valid Win32 application

The code fails in line 43 of the the core.py file: lib = ctypes.windll.LoadLibrary(os.path.join(root, directory, name))

jirhiker commented 5 years ago

don't know. I didn't make that dll. I only run linux and osx. That dll was provided by #3

sashagaz commented 5 years ago

Hey Jake, my problem was with the .dll file. I am using 64 bit Python and I replaced your .dll with the one from toupcam: https://touptek.com/download/showdownload.php?id=32&lang=en Thanks for the replies and help.