Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with sample code #5

Closed
sashagaz opened this issue Aug 19, 2019 · 9 comments
Closed

Problem with sample code #5

sashagaz opened this issue Aug 19, 2019 · 9 comments

Comments

@sashagaz
Copy link

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
Copy link
Member

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

@sashagaz
Copy link
Author

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

@jirhiker
Copy link
Member

can you send more of the error trace?

Maybe try python 2.7

@sashagaz
Copy link
Author

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
Copy link
Member

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

@jirhiker
Copy link
Member

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

@sashagaz
Copy link
Author

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
Copy link
Member

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

@sashagaz
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants