Problem using select for socket i/o and zigbee.py

I am using zigbee.py from the embedded gateway viewer kit and performing socket I/O via an XBIB configured as an API co-ordinator.

When attempting to use select to determine when data is available for reading an exception is generated in zigbee.py/zigbee_select - ‘start_time undefined’. I am not specifying a timeout (4th parameter) and therefore start_time is not initialised. If I do specify a timeout the function seems to go into a tight loop as evident through high CPU usage and never returns.

The offending line is:

time.sleep(min(SELECT_SLEEP_TIME, abs(start_time + timeout - time.time())))

if I modify this to:

time.sleep(SELECT_SLEEP_TIME)

It works correctly using the default SELECT_SLEEP_TIME as defined in the function.

I have tested this using the Non Block I/O example from the DIGI Python Programming Guide and can confirm this code fails on a PC host using zigbee.py, but works successfully on an X4 gateway.

Thanks, Dean

Message was edited by: deancs