Using the new to v22 python library, connecting our interfacekit 0/16/16 (v605) sometimes hangs on openWaitForAttachment(), resulting in a timeout exception. Doesn't seem to happen using the C lib directly, nor was happening with the v21 python library.
The timeout happens equally with DigitalInput and DigitalOutput, and it doesn't seem to matter the timeout value given or if a delay is added between calls.
With the following minimal demo code (open and close all 16 output channels) we can see the error about every 10 runs so so:
Code: Select all
import time
from Phidget22.Devices.DigitalOutput import DigitalOutput
from Phidget22.PhidgetException import PhidgetException
def open(ch):
try:
ch.openWaitForAttachment(5000)
return True
except PhidgetException as e:
print("*** Couldn't open:", end=" ")
print("Exception %i: %s" % (e.code, e.details), end=" *** ")
close(ch)
def close(ch):
try:
ch.close()
except PhidgetException as e:
print("Couldn't close channel:", end=" ")
print("Exception %i: %s" % (e.code, e.details))
del(ch)
print("Closed.")
def open_and_close_channel(ch_num):
ch = DigitalOutput()
ch.setChannel(ch_num)
print("Opening output", ch_num, end="... ", flush=True)
if open(ch):
print("Open.", end=" ")
close(ch)
for n in range(16):
open_and_close_channel(n)
time.sleep(.1) # changing the delay doesn't make a difference
Code: Select all
Opening output 0... Open. Closed.
Opening output 1... Open. Closed.
Opening output 2... Open. Closed.
Opening output 3... Open. Closed.
Opening output 4... Open. Closed.
Opening output 5... Open. Closed.
Opening output 6... Open. Closed.
Opening output 7... Open. Closed.
Opening output 8... Open. Closed.
Opening output 9... Open. Closed.
Opening output 10... Open. Closed.
Opening output 11... Open. Closed.
Opening output 12... *** Couldn't open: Exception 3: Timed Out *** Closed.
Opening output 13... Open. Closed.
Opening output 14... Open. Closed.
Opening output 15... Open. Closed.