[Hamlib-developer] Python Hamlib - checking for invalid frequency
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Phil <phi...@gm...> - 2023-02-11 00:30:26
|
Thank you for reading this. How do I check for an invalid frequency or any other errors? In this example, print(f"Error setting frequency: {error}") is never reached. import Hamlib rig = Hamlib.Rig(Hamlib.RIG_MODEL_FT991) rig.set_conf("rig_pathname", "/dev/ttyUSB0") rig.set_conf("serial_speed", "4800") rig.open() #freq = 1.3 * 10000000 # this is a valid frequency freq = 10.3 * 10000000 # this is an invalid frequency #ret_code = rig.set_freq(Hamlib.RIG_VFO_A, (freq)) # retcode is always None try: rig.set_freq(Hamlib.RIG_VFO_A, (freq)) except Hamlib.RigError as error: print(f"Error setting frequency: {error}") -- Regards, Phil |