Closed DownInTheShop closed 3 years ago
We don't supply the SimConnect.dll in the pip package, The best place is for now is the SDK, You can just place it in the same DIR as your script.
Ah ok, thanks.
I have this error, too. My pip package came with the SimConnect.dll. I replaced it in the package and placed a copy in the script directory from the SDK and still get this error.
@abecor this is an old issue and has be change in the later versions. There is not need to move or replace the dll provide by the pip package. This code is only validated on the dll version provide by the pip package, not to say others will not work. if you have just installed the pip package and are getting this error, more info about your system would be needed.
This is my error with a fresh pip package install:
Traceback (most recent call last):
File "E:\coding\python\simconnect_test\simconnect_test.py", line 4, in <module>
sm = SimConnect()
File "C:\Users\Philipp\AppData\Local\Programs\Python\Python39-32\lib\site-packages\SimConnect\SimConnect.py", line 125, in __init__
self.dll = SimConnectDll(library_path)
File "C:\Users\Philipp\AppData\Local\Programs\Python\Python39-32\lib\site-packages\SimConnect\Attributes.py", line 18, in __init__
self.SimConnect = cdll.LoadLibrary(library_path)
File "C:\Users\Philipp\AppData\Local\Programs\Python\Python39-32\lib\ctypes\__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "C:\Users\Philipp\AppData\Local\Programs\Python\Python39-32\lib\ctypes\__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 ist keine zulässige Win32-Anwendung
Win10, Python 3.9, MSFS2020
@abecor you seem to be running 32bit vs 64bit.
using 32bit Python 3.9.0
PS C:\buld\TestDir> python.exe .\local_example.py
INFO:__main__:START
Traceback (most recent call last):
File "C:\buld\TestDir\local_example.py", line 14, in <module>
sm = SimConnect()
File "C:\Python39-32\lib\site-packages\SimConnect\SimConnect.py", line 125, in __init__
self.dll = SimConnectDll(library_path)
File "C:\Python39-32\lib\site-packages\SimConnect\Attributes.py", line 18, in __init__
self.SimConnect = cdll.LoadLibrary(library_path)
File "C:\Python39-32\lib\ctypes\__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "C:\Python39-32\lib\ctypes\__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
using 64bit Python 3.9.0, No error:
PS C:\buld\TestDir> python.exe .\local_example.py
INFO:__main__:START
DEBUG:SimConnect.SimConnect:Connected to Flight Simulator!
INFO:SimConnect.SimConnect:SIM OPEN
Hope this helps. all add a note to the Readme
Yes, that did it. Thanks a lot!
New run error for local_example