Error when using ctypes in Python.

Asked 2 years ago, Updated 2 years ago, 17 views

Whether it's a .so file or a .dll file, if you just try to load it (even if you write down the path, just put it in the folder right away)

The error "[WinError 193] %1 is not a valid Win32 application" keeps appearing.

I kept searching, and they said that the version didn't fit.

Anaconda is 64-bit The print (ctypes.windll.kernel32) is printed like this The print(ctypes.windll.kernel64) displays an error such as 'OSError: [WinError 126] The specified module could not be found'.

Just in case, I tried again in Python 2.x version (32-bit), but

Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\ctypes_init.py", line 366, in __init_ self._handle = _dlopen(self._name, mode) WindowsError: [Error 126]

This error keeps coming out the same way.

I don't know how to find a clue.

python ctypes

2022-09-22 13:27

1 Answers

Python is therefore difficult.

Understanding the system is essential to do well. Rather, Java mostly develops Java libraries, so you don't need to have this system knowledge, but Python uses a lot of expansion modules, making it difficult to troubleshoot if it's not a pure python error.

There are various cases where errors such as the body can occur.

The information from the body is that the os used are Windows 64 and the python interpreter also uses 64 bits.

In Windows, dll can only be called with the same architecture. 64-bit python means that only 64-bit compiled dlls can be called. If it's 32-bit, it's only 32-bit dll. Considering that, I don't think the dll call itself is wrong.

The problem should be that you can determine if the dll you are trying to call is intact. This is when you need knowledge of the system. I wish I had knowledge of peformat.

If you can see the dll information, please find it and let me know, and if you can't, please post the dll you want to call. You can put it up where you can share it with Google Drive or github.


2022-09-22 13:27

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.