Timeout not working in pyxid2 (Cedrus RB-740)

Hi Experts,

I have been trying to get response from a Cedrus RB-740 using pyxid2. I am getting the response when button is pressed. But when I give a timeout its throwing an error.
This is the code:

devices = pyxid2.get_xid_devices()

dev = devices[0]
print(dev)
dev.reset_base_timer()
dev.reset_rt_timer()

start_timer = clock.getTime()
if dev.is_response_device():
    print ("Press a key!")
    while not dev.has_response():
        dev.poll_for_response()
        stop_timer = clock.getTime()
        rt = round(stop_timer - start_timer,5)*1000
        if rt>500: # timeout after 500ms
            break
    response = dev.get_next_response()
    response['time'] = rt
    print(response)
    print(response['key'])
    dev.clear_response_queue()

Output:
<XidDevice “Cedrus RB-740”>
Press a key!
Traceback (most recent call last):
File “response pad test.py”, line 23, in
response = dev.get_next_response()
File “C:\Program Files\PsychoPy\lib\site-packages\pyxid2\pyxid_impl.py”, line 241, in get_next_response
return self.response_queue.pop(0)
IndexError: pop from empty list

Python version: 3.10.2
Psychopy version: 2021.2.3
Windows 10 OS
All 64 bit

Any suggestions are appreciated. Thanks in advance!

You also posted on the Cedrus forums. Please see the reply there.