Phidget Fails on getDataInterval

Technical Discussions on any InterfaceKits
Post Reply
Rhybot
Phidgeteer!
Posts: 52
Joined: Wed Aug 14, 2019 4:58 pm
Contact:

Phidget Fails on getDataInterval

Post by Rhybot »

Hello Phidget Forums,

I am using a TMP1101_0 to measure some temperatures using a few thermocouples. I have a Python driver written that queries various metrics such as data interval and temperature every so often.

I noticed after several hours of operation, seemingly due to no reason at all, calling getDataInterval() raises:

Code: Select all

PhidgetException 0x34 (Device not Attached)
This has now happened about 5 times, and only with getDataInterval(). I am going to be writing a wrapper method in my driver that suppresses this exception.

Why does this exception keep coming up?
Rhybot
Phidgeteer!
Posts: 52
Joined: Wed Aug 14, 2019 4:58 pm
Contact:

Re: Phidget Fails on getDataInterval

Post by Rhybot »

After 3 straight days of running, I just had my Python code randomly fail with this exception:

Code: Select all

  File "C:\path\to\venv\lib\site-packages\Phidget22\Devices\TemperatureSensor.py", line 193, in getTemperatureChangeTrigger
    raise PhidgetException(result)
Phidget22.PhidgetException.PhidgetException: PhidgetException 0x34 (Device not Attached)
I am now thinking perhaps the Phidget Python libraries are not reliable for continual monitoring programs. :?
fraser
Engineering
Posts: 138
Joined: Thu Nov 19, 2009 4:41 pm
Contact:

Re: Phidget Fails on getDataInterval

Post by fraser »

I will see if I can reproduce this.

Are you catching exceptions in your program or doing any error handling? Disconnects can happen for a number of reasons and if you're doing continuous monitoring then it's best to design for them just in case. Is the device open at all times or are you opening/polling/closing? Running event based programming will also help reduce the chance of exceptions. Just a few things for you to consider while I see if this is something on our end or not
Rhybot
Phidgeteer!
Posts: 52
Joined: Wed Aug 14, 2019 4:58 pm
Contact:

Re: Phidget Fails on getDataInterval

Post by Rhybot »

Hi fraser,

Thank you for replying!

To answer your questions:
  • Device is attached during program initialization, and remains open at all times
  • I have a UI (updates at 1-5 Hz) that uses:
    - Methods like getTemperatureChangeTrigger() and getDataInterval() to display Phidget configuration information
    - Event-based programming for temperature change events
Per exception handling:
1. Originally there was no exception handling
2. With getDataInterval() raising PhidgetException (0x34), I wrapped it with Python's retry decorator, retrying the method three times before erroring out. This still didn't work, the method would just get retried three times and would raise the same exception three times
3. Now, I just silence PhidgetException with code 0x34 on getDataInterval() and getTemperatureChangeTrigger() calls.
- Interesting note: events still happen after silencing an error, I continue to get temperature readings

What I can do is circle back and see if the getter methods work again after silencing their exception.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest