Python-SimConnect icon indicating copy to clipboard operation
Python-SimConnect copied to clipboard

AttributeError self.event = self.sm.map_to_sim_event(self.deff)

Open laurentQuarkfr opened this issue 1 year ago • 0 comments

python 3.12

from SimConnect import *
from SimConnect.EventList import *
from SimConnect.RequestList import *


def trigger_event(event_name, value_to_use = None):
    EVENT_TO_TRIGGER = ae.find(event_name)
    if EVENT_TO_TRIGGER is not None:
        if value_to_use is None:
            EVENT_TO_TRIGGER()
        else:
            EVENT_TO_TRIGGER(int(value_to_use))
        print("success")
        return True
    else:
        print("Error: %s is not an Event" % (event_name))
        return False
        
sm = SimConnect()
ae = AircraftEvents(sm)
trigger_event('COM_STBY_RADIO_SET', dec_to_bcd(125.850))

trigger_event('COM_STBY_RADIO_SET', dec_to_bcd(125.850)) File "D:\SharedFolder\PythonProjects\MFS-WINWING\send.py", line 122, in trigger_event EVENT_TO_TRIGGER(int(value_to_use)) File "C:\Users\VHDX-DEFAULT\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\SimConnect\EventList.py", line 8, in call self.event = self.sm.map_to_sim_event(self.deff) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\VHDX-DEFAULT\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\SimConnect\sc.py", line 60, in getattr raise AttributeError

laurentQuarkfr avatar Dec 14 '23 20:12 laurentQuarkfr