# Key duration is always None in 2022 psychopy

**URL:** <https://discourse.psychopy.org/t/key-duration-is-always-none-in-2022-psychopy/28898>\
**Category:** Builder\
**Created:** [April 28, 2022, 1:28pm UTC](https://discourse.psychopy.org/t/key-duration-is-always-none-in-2022-psychopy/28898 "2022-04-28T13:28:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmagnuski](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/mmagnuski/32/11741_2.png) [@mmagnuski](https://discourse.psychopy.org/u/mmagnuski)\
**Post date:** [April 28, 2022, 1:28pm UTC](https://discourse.psychopy.org/t/key-duration-is-always-none-in-2022-psychopy/28898/1 "2022-04-28T13:28:36Z")

</div>

**PsychoPy version:** `2022.1.3`  
**operating system:** `Windows 10 Pro 21H2 version`

I have a problem similar to [this one](https://discourse.psychopy.org/t/duration-of-key-is-always-none/24442), an experiment that was running locally without problems on 2021 version of PsychoPy, now works incorrectly on 2022.1.3 (Windows). In that experiment I use the following:

```python
keys = kb.getKeys(keyList=['f', 'j', 'space'], waitRelease=False,
                  clear=False)

```

to allow the participant to change dot position. However now every `key.duration` is `None` even for keys that were released.

Maybe related, I get “loaded more than 1 DLL” warning when I start the experiment:

```auto
C:\Program Files\PsychoPy\lib\site-packages\numpy\_distributor_init.py:30: UserWarning: loaded more than 1 DLL from .libs:
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
1.4849 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['sounddevice', 'PTB', 'pyo', 'pygame'] (in that order).
6.5197 WARNING User requested fullscreen with size [1536 864], but screen is actually [3840, 1080]. Using actual size
C:\Program Files\PsychoPy\lib\site-packages\numpy\_distributor_init.py:30: UserWarning: loaded more than 1 DLL from .libs:
C:\Program Files\PsychoPy\lib\site-packages\numpy\.libs\libopenblas.PYQHXLVVQ7VESDPUVUADXEVJOBGHJPAY.gfortran-win_amd64.dll
C:\Program Files\PsychoPy\lib\site-packages\numpy\.libs\libopenblas.XWYDX2IKJW2NMTWSFYNGFUWKQU3LYTCZ.gfortran-win_amd64.dll
  warnings.warn("loaded more than 1 DLL from .libs:"
C:\Program Files\PsychoPy\lib\site-packages\numpy\.libs\libopenblas.PYQHXLVVQ7VESDPUVUADXEVJOBGHJPAY.gfortran-win_amd64.dll
C:\Program Files\PsychoPy\lib\site-packages\numpy\.libs\libopenblas.XWYDX2IKJW2NMTWSFYNGFUWKQU3LYTCZ.gfortran-win_amd64.dll
  warnings.warn("loaded more than 1 DLL from .libs:"
1.0360 WARNING Monitor specification not found. Creating a temporary one...
ioHub Server Process Completed With Code: 0
################# Experiment ended with exit code 0 [pid:5656] #################

```

I also get this error when opening PsychoPy GUI (this started just after uninstalling 2021 version and installing the 2022):  
 ![new_version_sucks](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/e/a/ea5bad0f2695756e28e412cdd6fc7ca5ac06c578.png)

I says “could not find point of entry for procedure ?PyWinObject…@Z in library C:\Users…”.  
I find it weird that it mentiones anaconda python distribution, I installed psychoPy from the standalone installer…

**Update1:** the minimal example of the procedure works well on `2021.2.3`. I will try the 2022 version on another computer later today.  
**Update2:** fortunatelly, it works online when using `.getEvents()` and checking KeyEvent.status for `'KEY_DOWN'` and `'KEY_UP'`

---

<div class="post-metadata">

**Author:** ![jasbisch](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@jasbisch](https://discourse.psychopy.org/u/jasbisch)\
**Post date:** [July 15, 2022, 2:26pm UTC](https://discourse.psychopy.org/t/key-duration-is-always-none-in-2022-psychopy/28898/2 "2022-07-15T14:26:00Z")

</div>

Hey mmagnuski,

I had a similar problem. What solved mine was to adjust the experiment settings and switch ‘Keyboard Backend’ under ‘Input’ to ‘PsychToolbox’ (from ‘ioHub’):  
 ![grafik](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/0/6/06ddd5b19acdf71b5d7fcef6aff97739d7d46b68.png)

Best regards  
Jasper

---

<div class="post-metadata">

**Author:** ![rooftopology](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@rooftopology](https://discourse.psychopy.org/u/rooftopology)\
**Post date:** [November 16, 2022, 3:15am UTC](https://discourse.psychopy.org/t/key-duration-is-always-none-in-2022-psychopy/28898/3 "2022-11-16T03:15:33Z")

</div>

I’m having exactly this problem: key.duration remains None with pyglet even after the key is released.

Unfortunately I cannot switch to PTB backend which does not seem to work with my MRI-compatible button box (cf. [Buttonbox delay - Programming Help - Psychtoolbox](https://psychtoolbox.discourse.group/t/buttonbox-delay/3873)).  
Is there another way of checking whether a key has been released that would work even with pyglet?
