Page 1 of 1

Bug: KeyboardInterrupt is not called

Posted: Tue Feb 28, 2023 2:58 pm
by dsandber
In the code below, if I ctrl^c, the message "Got KB interrupt" is not shown. If I comment out the "scale.openWai..." line, then "Got KB interrupt" is shown when I ctrl^C.

The normal control-flow of the program should not be changed just because a Phidget is being used.

Code: Select all

def main():
	try:
		scale = VoltageRatioInput()
		scale.openWaitForAttachment(5000)

		while True:
			pass
	except KeyboardInterrupt:
		print("Got KB interrupt")

Re: Bug: KeyboardInterrupt is not called

Posted: Tue Feb 28, 2023 3:55 pm
by mparadis
When I run this code I get "Got KB interrupt" regardless of whether the 'open' line is commented out. If the Phidget isn't physically connected, I get a timeout exception after 5 seconds, as expected. I get the same behaviour on python 2.7.18 and python 3.6.7.