Bug: KeyboardInterrupt is not called

Supporting 2.7 and 3.2+
Post Reply
dsandber
Fresh meat
Posts: 1
Joined: Tue Feb 28, 2023 12:59 pm
Contact:

Bug: KeyboardInterrupt is not called

Post 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")
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Bug: KeyboardInterrupt is not called

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest