I am running some code closely based on the ‘pstbox’ demo to set up communication with a PST button box. I have a Coder program and a Builder program containing more or less the same code. In PsychoPy v2021.2.3, my Coder program and my Builder program both work. In PsychoPy v2022.1.0 and later, my Coder program still works, but my Builder program does not. In PsychoPy v2023.2.3, my Coder program doesn’t work either.
The error message differs between PsychoPy versions. From v2022.1.0 to v2023.1.3, the error message when running Builder occurs when attempting to open a connection to ioHub:
File “\uol.le.ac.uk\root\staff\home\r\rk239\My Documents\UG students 2023-24\Todor startle reflex\audio expt_lastrun.py”, line 134, in
io = launchHubServer(**iohubkwargs)
File “C:\ProgramData\App-V\657C798E-03B8-4382-8127-C5E0750BE384\C4D6D8E3-76B6-4077-B45D-157988F695D8\Root\PsychoPy\lib\site-packages\psychopy\iohub\client\connect.py”, line 256, in launchHubServer
return ioHubConnection(iohub_config)
File “C:\ProgramData\App-V\657C798E-03B8-4382-8127-C5E0750BE384\C4D6D8E3-76B6-4077-B45D-157988F695D8\Root\PsychoPy\lib\site-packages\psychopy\iohub\client_init_.py”, line 267, in init
raise RuntimeError(‘An existing ioHubConnection is already open.’
RuntimeError: An existing ioHubConnection is already open. Use ioHubConnection.getActiveConnection() to access it; or use ioHubConnection.quit() to close it.
################# Experiment ended with exit code 1 [pid:4256] #################
It looks as if this bug was fixed in v2023.2.0 (BF: Allow ioHub to be initialised multiple times without error by TEParsons · Pull Request #5533 · psychopy/psychopy · GitHub), but a different error message occurs when running Builder in this version and all later versions when attempting to establish communication with the pstbox:
ioHub Server Process Completed With Code: 0
File “F:\Users\GK\Documents\Richard\Psychology Technician\After losing laptop\Todor startle reflex\startle expt_lastrun.py”, line 1836, in
run(
File “F:\Users\GK\Documents\Richard\Psychology Technician\After losing laptop\Todor startle reflex\startle expt_lastrun.py”, line 340, in run
pstbox = io.devices.pstbox
AttributeError: ‘ioHubDevices’ object has no attribute ‘pstbox’
################# Experiment ended with exit code 1 [pid:6420] #################
The error message that occurs when running Coder in v2023.2.3 is more complex and I’m not sure how to unpick it:
ERROR: DEVICE CONFIG ERRORS FOUND! IOHUB NOT LOADING DEVICE: psychopy.iohub.devices.serial
errors count 1:
(‘monitor_event_types’, [‘PstboxButtonEvent’])Device was not started by the ioHub Server: serial.Pstbox
Error during device creation …
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\server.py”, line 723, in createNewMonitoredDevice
raise ioHubError(‘Device config validation failed’)
psychopy.iohub.errors.ioHubError: ioHubError:
Args: (‘Device config validation failed’,)Error during device creation …
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\server.py”, line 723, in createNewMonitoredDevice
raise ioHubError(‘Device config validation failed’)
psychopy.iohub.errors.ioHubError: ioHubError:
Args: (‘Device config validation failed’,)During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\server.py”, line 649, in _addDevices
self.createNewMonitoredDevice(dev_cls_name, dev_conf)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\server.py”, line 728, in createNewMonitoredDevice
raise ioHubError(‘Error during device creation …’)
psychopy.iohub.errors.ioHubError: ioHubError:
Args: (‘Error during device creation …’,)GET_DEV_INTERFACE_ERROR: getRPCInterface returned: None
2.3820 WARNING launchHubServer: Use of psychopy_monitor_name is deprecated. Please use window= and provide a psychopy window that has a .monitor.
Traceback (most recent call last):
5.4394 WARNING Monitor specification not found. Creating a temporary one…
2.3620 WARNING Monitor specification not found. Creating a temporary one…
ioHub Server Process Completed With Code: 0
File “F:\Users\GK\Documents\Richard\Psychology Technician\After losing laptop\Lamps Test PsychoPy\lampsTest_for_Python3.py”, line 80, in
pstbox.clearEvents()
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\client_init.py", line 153, in getattr
raise AttributeError(self, name)
AttributeError: (<psychopy.iohub.client.ioHubDeviceView object at 0x000001D18EC60BB0>, ‘clearEvents’)
################# Experiment ended with exit code 1 [pid:7356] #################
We use PST button boxes to transmit signals sent via a USB port to the parallel port on the back of a BIOPAC MP36 in order to place markers on a physiological trace. So although the PST button boxes are no longer being sold, they remain very useful to us and we need PsychoPy to continue to support them! Please can you take a look and see if you can fix this?