odwdinc / Python-SimConnect

Python interface for MSFS2020 SimConnect.dll
GNU Affero General Public License v3.0
270 stars 107 forks source link

SIMCONNECT_EXCEPTION_VERSION_MISMATCH #88

Closed iceyrazor closed 3 years ago

iceyrazor commented 3 years ago

i have gone through and done EVERYTHING from this post: https://github.com/odwdinc/Python-SimConnect/issues/75

and i can not for the life of me get this to work. AND there is no older version of this libary. so i cant use older versions

-i cant run pycharm projects in normal python. so running 32 bit is out of the question -ive copyied the simconnect dll from the libary to fsx -ive reinstalled fsx and re ran all the simconnect installers and restarted my pc

im litterly pulling my hair out with this. why is this so god damm complicated for a library that is supposed to make things simpler

and doing what the post says and replacing the to lines i get the error attached below Capture222

iceyrazor commented 3 years ago

just saw this post https://github.com/odwdinc/Python-SimConnect/issues/49 and still. i cant run my file with normal python at all. even if i remove the simconnect stuff and just run the stuff that does work. it opens for a split second then closes. with no processes running in task manager

iceyrazor commented 3 years ago

nvm i can run it in 32 bit. its just closing because its crashing XD. so thats one thing solved.

still giving me the same errors though

storca commented 3 years ago

Hi

I would love to help, since you seem to be trying to make this library work for FSX.

However, I don't really understand what you are trying to achieve ; are you trying to make this work with FSX?

What have you done exactly to the different simconnect.dll files? Moving "stuff" around is not precise enough.

To clarify #49, last time this worked, I had to find the 32 bit version of simconnect.dll which is located in the FSX:SE install folder to replace the 64bit one in the library and run the python script with python 32 bit.

You should not replace the Simmconnect.dll located in the FSX:SE folder, this might break your installation.

iceyrazor commented 3 years ago

yes i am trying to make this work with FSX:SE.

where exactly is the dll in install folder on steam edition? is it just the common>fsx folder?

how do i see errors from a py script without it crashing or using pycharm? because pycharm doesn't run 32.bit

as one of the post suggest, i copied the simconnect.dll file from the library and replaced the one in fsx. though i think their the same so no issues there

i didn't move any other simconnect files. i ran the msi files (i ithink, or exe) in the sdk folder an installed them.

an the final thing i did was change.

self.Open = self.SimConnect.SimConnect_Open

to

self.Open = self.SimConnect.SimConnect

in the Attributes.py file witch gave me the second error shown in the image

though i see that that was for prepare 3d. it was just wish full thinking that would help with fsxse to some extent... it didn't

storca commented 3 years ago

On my side, the FSX:SE Simconnect.dll file is located in <your steam install folder>/steamapps/common/FSX/SimConnect.dll

I insist on running your scripts on python 32 bit, because python 64 bit cannot load 32 bit static libraries (i.e. FSX:SE SimConnect.dll), you have to check that first.

You should not replace the SimConnect.dll file located in the FSX:SE folder. You should do the opposite, you must replace the SimConnect.dll of this python library, which you must locate in your 32bit python installation. If you did not backup your previous FSX:SE 32bit SimConnect.dll, you'll have to find the correct version or reinstall FSX.

I don't remember changing things in python library's code, things should work fine with this version, I'll check that. EDIT: things work fine today, last commit was b465b65

You messed up with the dlls, maybe take a deep breath of fresh air.

iceyrazor commented 3 years ago

oh yeah. when i made this post i switched to doing somthing else. helps me think of other things that could be going wrong. ill give this ago tommorow though

but why wouldn't replacing the file from the library to the one in fsx work?

iceyrazor commented 3 years ago

but again. how do i see a python scripts error's without it crashing? try and catch?

storca commented 3 years ago

Definitly give it a go, that's how it worked for me.

Because the SimConnect.dll used in this library is the one from MFS2020, not FSX:SE, it is a newer version of it. The simconnect version mismatch happened when I ran the library without changing anything, on python 64 bit with the original Simconnect.dll (from MSFS2020).

I'm not specifically aware of this, maybe ask google about that.

iceyrazor commented 3 years ago

feel like this is progress.

1.now i get this error image

2.when i try running with normal python. it crashes upon having this import line.

from SimConnect import *

i saw somewhere about dynamic imports or somthing. should i use directories with import or somthing else?

this applies to any import line for that matter

import serial import json import threading import time

iceyrazor commented 3 years ago

wait no its the import serial part.. ok so the libraries i imported are just for pycharm. i think i know the fix. how do i install libraries via normal python?

idk about the first error though.

storca commented 3 years ago

The OSError occured when there was an architecture mismatch between python and SimConnect.dll (32bit vs 64bit). If you do exactly what's above, things work. Here's a screenshot of my setup, with the latest version of the library and FSX:SE.

simconnect

Also keep in mind that every post on this thread notifies the people who are watching this repository.

iceyrazor commented 3 years ago

ok im having trouble installing libraries to normal python.

i cant use the cd command AT ALL

iceyrazor commented 3 years ago

The OSError occured when there was an architecture mismatch between python and SimConnect.dll (32bit vs 64bit). If you do exactly what's above, things work. Here's a screenshot of my setup, with the latest version of the library and FSX:SE.

simconnect

Also keep in mind that every post on this thread notifies the people who are watching this repository.

hay, im still having issues. i cant use a library installed by pycharm. how do i install using normal python? i cant seem to even do that

please dont close a post until its actully solved

iceyrazor commented 3 years ago

pip install isnt even a function image

iceyrazor commented 3 years ago

I GOT IT TO WORK! thanks for your bit of help though :)

ill explain my own steps in a second

iceyrazor commented 3 years ago

do the following steps

-install python32 bit from the python page. -find the python 32 bit exe and rename it to python32.exe (if 64 bit is installed it conflicts in setting it as default app even though they are in separate folders. windows imr). -open a normal windows cmd terminal in the python 32 directory and do the following. python32.exe -m pip install SimConnect then python32.exe -m pip show SimConnect and open the 'Location:' directory in your file browser

-if simconnect does not exist in your fsx directory. open steam and verify game integrity, if its still not there. locate you fsx game folder. go into SDK\Core Utilities Kit\SimConnect SDK\lib and run SimConnect.msi (you may still need to run this if it still doesn't work) -back in the FSX directory. copy SimConnect.dll FROM fsx TO the python simconnect lib folder you had open before. -right click on your python file that actully does the connecting. and click open with. and choose different app. locate the python32 exe file as before (you may want to set as default too).

and you should be good to go

there probly is a shorter better way of doing this but this is pretty much the route i took. hope it helps

storca commented 3 years ago

Great your got it working!

A small addition to your steps : on windows, along with python you can install a tool that manages multiple python versions for you, on the python installer it's called "py launcher".

So instead of messing with python executables, you type in py -0 to list versions and py -3.9-32 myfile.py to launch python 3.9 32bit on myfile.py. It's a just a more practical way of working with multiple python installations on windows.

iceyrazor commented 3 years ago

thanks. but i found out you can also do python32 -m pip, after reinstalling and enabling enviroment variables on the install option.

think you could help out with this? https://github.com/odwdinc/Python-SimConnect/issues/89