# Timeout not working in pyxid2 (Cedrus RB-740)

**URL:** https://discourse.psychopy.org/t/timeout-not-working-in-pyxid2-cedrus-rb-740/26957
**Category:** Coding
**Created:** [January 22, 2022, 2:06pm UTC](https://discourse.psychopy.org/t/timeout-not-working-in-pyxid2-cedrus-rb-740/26957 "2022-01-22T14:06:55Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![nithin](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@nithin](https://discourse.psychopy.org/u/nithin)
#### Post date: [January 22, 2022, 2:06pm UTC](https://discourse.psychopy.org/t/timeout-not-working-in-pyxid2-cedrus-rb-740/26957/1 "2022-01-22T14:06:55Z")

</div>

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:

```auto
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!

---

<div class="post-metadata">

### Author: ![habboud](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/habboud/32/5769_2.png) [@habboud](https://discourse.psychopy.org/u/habboud)
#### Post date: [January 26, 2022, 12:58am UTC](https://discourse.psychopy.org/t/timeout-not-working-in-pyxid2-cedrus-rb-740/26957/2 "2022-01-26T00:58:11Z")

</div>

You also posted on the Cedrus forums. Please see the reply **[there](https://community.cedrus.com/t/no-response-on-cedrus-rb-740-is-throwing-an-error-pop-from-empty-list/7065)**.
