Bug Report - Phidget22Python: Intermittent timeout when using openWaitForAttachment()

Supporting 2.7 and 3.2+
Post Reply
mofahead
Fresh meat
Posts: 2
Joined: Wed Mar 28, 2018 12:45 pm
Contact:

Bug Report - Phidget22Python: Intermittent timeout when using openWaitForAttachment()

Post by mofahead »

Hi,

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
A failing run looks like this:

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.
mofahead
Fresh meat
Posts: 2
Joined: Wed Mar 28, 2018 12:45 pm
Contact:

Re: Bug Report - Phidget22Python: Intermittent timeout when using openWaitForAttachment()

Post by mofahead »

Forgot to mention, the base system is Ubuntu 16.04 (64-bit).
User avatar
Patrick
Lead Developer
Posts: 634
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Bug Report - Phidget22Python: Intermittent timeout when using openWaitForAttachment()

Post by Patrick »

I've been able to reproduce. Looking into it now.

-Patrick
User avatar
Patrick
Lead Developer
Posts: 634
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Bug Report - Phidget22Python: Intermittent timeout when using openWaitForAttachment()

Post by Patrick »

Fixed. Releasing new library now.

-Patrick
aho
Fresh meat
Posts: 3
Joined: Mon May 07, 2018 7:25 pm
Contact:

Re: Bug Report - Phidget22Python: Intermittent timeout when using openWaitForAttachment()

Post by aho »

Hi Patrick,

I think that I'm hitting a similar bug and wanted to make sure that I'm picking up your bug fix. I'm assuming that you just changed the Phidget Python library and not the C library?

Cheers

Code: Select all

>>> Phidget22.Phidget.Phidget.getLibraryVersion()
'Phidget22 - Version 1.0.0 - Built May  2 2018 19:19:13'
>>>
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests