Hi guys!
OS (e.g. Win10): Win 11 Pro
PsychoPy version (e.g. 2024.2.4 Py 3.8): 2024.2.4 Py 3.8.1
**Standard Standalone Installation? (y/n) y
**Do you want it to also run online? (y/n) n
What are you trying to achieve?:
My simple experiment is: present a sound, rate the pleasantness 1-9 using a keypad. Currently I am encountering the described error on some runs.
What did you try to make it work?:
Repeat experiment session, full screen/windowed, switching keyboard backend, confirming correct screen ID, disconnecting additional keyboard.
Link to the most relevant existing thread you have found:
What specifically went wrong when you tried that?:
None of the fixes I tried worked. The error does not always appear, for some reason. For example, by keeping everything constant, it would appear 3 out of 5 tries. But a pattern I observed is that the error always occurred after the end of a sound, and usually at the end of the experiment (when the participant is supposed to rate the last sound clip).
Full output and error message:
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. Contribute - pygame wiki
released: [(0.7899696994572878, ‘num_1’, 0.1365384003147483)]
trigger sent for this release
lines all cleared
released: [(1.3951693000271916, ‘num_5’, 0.14420550037175417)]
Traceback (most recent call last):
trigger sent for this release
lines all cleared
7.5466 WARNING launchHubServer: If using the iohub mouse or eyetracker devices, fullScr should be True.
File “C:\Users\DMHARL\Documents\Emotion fNIRS\Psychopy files\Haiping_dissertation\IADS_recognition_AO_lastrun.py”, line 1529, in
run(
File “C:\Users\DMHARL\Documents\Emotion fNIRS\Psychopy files\Haiping_dissertation\IADS_recognition_AO_lastrun.py”, line 1184, in run
keys_released = kb.getKeys([‘num_1’,‘num_2’,‘num_3’,
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\hardware\keyboard.py”, line 231, in getKeys
return self.device.getKeys(
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\hardware\keyboard.py”, line 494, in getKeys
self.dispatchMessages()
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\hardware\keyboard.py”, line 607, in dispatchMessages
key_events = KeyboardDevice._iohubKeyboard.getKeys(clear=True)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\client\keyboard.py”, line 329, in getKeys
self._syncDeviceState()
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\client\keyboard.py”, line 232, in _syncDeviceState
events = {int(k): v for k, v in list(kb_state.get(‘events’).items())}
AttributeError: ‘NoneType’ object has no attribute ‘get’
Further context: We have two monitors and two keyboards connected to the same PC. The participant sits inside the sound booth and has their own monitor and keyboard. The experimenter sits outside the booth and has their own monitor and keyboard.
I do have a code component that is used to monitor key presses and send trigger out accordingly, I wonder if this caused the problem:
Each Frame:
keys_released = key_resp_SAM.getKeys([‘num_1’,‘num_2’,‘num_3’,‘num_4’,‘num_5’,‘num_6’,‘num_7’,‘num_8’,‘num_9’], waitRelease=True, clear=True)
if keys_released:
print("released: ", [(k.rt, k.name, k.duration) for k in keys_released])
d.activate_line(Marker)
print(“trigger sent for this release”)
d.clear_all_lines()
print(“lines all cleared”)
Thank you guys in advance!