patricksurry / pysimconnect

Simple, efficient wrapper for FlightSimulator 2020's SimConnect SDK
MIT License
25 stars 9 forks source link

How do I properly close a SimConnect object ? #3

Open cercata opened 2 years ago

cercata commented 2 years ago

I'm just calling sc.Close(), but the next time I create a SimConnect() object, I don't receive new data, I get allways the last set of data the old object received.

patricksurry commented 2 years ago

is it easy to illustrate with a simple code example? i haven't played much with that, tho the API doc seems pretty clear you just need Open() and Close(). maybe the internal handle needs to get explicitly deleted or something, tho I would have thought that occurred when the python SimConnect object was implicitly deleted when you re-assign it. does explicit del sc help after Close?

cercata commented 2 years ago

This is where it's happening: https://github.com/cercata/pysim2bhap/blob/main/sim2bhap/msfsBHap.py

I tryied sc = None, I'll try del sc tomorrow