If this template helps then use it. If not then just delete and start from scratch.
OS (e.g. Win10): Win10 on a Dell Precision 3680
PsychoPy version (e.g. 2024.2.4 Py 3.8): v2025.1.1
Standard Standalone Installation? (y/n) y
Do you want it to also run online? (y/n) n
What are you trying to achieve?: Running an EEG experiment using a Magstim/EGI GES 400 EEG system with NetStation Acquisition without crashing
What did you try to make it work?: Replaced network cables; installed a UPS backup; reinstalled PsychoPy; turned off firewalls and background processes; reinstalled NetStation Acquisition; tried a different stimulation computer (MacBook Pro instead of the Dell machine); tried a replacement amplifier, router, and cables; reinstalled Windows 11; reinstalled Windows 10; tried a different experiment (the built-in Stroop experiment with EGI synchronization); asked EGI to test out our code…
What specifically went wrong when you tried that?:
An error message will still appear at random times/locations in most (but not all) experiment runs, specifically:
Traceback (most recent call last):
File "C:\Users\Labbies\Desktop\BNB_MMN2\BNB_MMN_V2_lastrun.py", line 3351, in <module>
run(
File "C:\Users\Labbies\Desktop\BNB_MMN2\BNB_MMN_V2_lastrun.py", line 2445, in run
win.flip()
File "C:\Users\Labbies\AppData\Local\Programs\PsychoPy\lib\site-packages\psychopy\visual\window.py", line 1428, in flip
self._toCall[i]['function'](*self._toCall[i]['args'], **self._toCall[i]['kwargs'])
File "C:\Users\Labbies\AppData\Local\Programs\PsychoPy\lib\site-packages\egi_pynetstation\NetStation.py", line 104, in wrapper
func(*args, **kwargs)
File "C:\Users\Labbies\AppData\Local\Programs\PsychoPy\lib\site-packages\egi_pynetstation\NetStation.py", line 294, in send_event
self._command('EventData', data)
File "C:\Users\Labbies\AppData\Local\Programs\PsychoPy\lib\site-packages\egi_pynetstation\NetStation.py", line 345, in _command
return parse_response(self._socket.read())
File "C:\Users\Labbies\AppData\Local\Programs\PsychoPy\lib\site-packages\egi_pynetstation\eci.py", line 165, in parse_response
raise InvalidECIResponse(bytearr)
egi_pynetstation.exceptions.InvalidECIResponse: b'ZZ'
None of our previous attempts seemed to work until we changed the keyboard backend in PsychoPy (reasoning that, perhaps, it was not playing well with NetStation/the amp on our setup for whatever reason). The experiment had been set to Psychtoolbox for the keyboard backend, but given that ioHub seems to be more robust when integrating with different devices, I thought I would give it a go. And it worked! Multiple times through. I did eventually get one crash on the nth run, but that was after PsychoPy and NetStation had been running for awhile, through multiple experiments and some forced exits. So I restarted both computers, and it was back to running fine. As an extra precaution, I then added in a bunch of event.clearEvents() at the end of routines.
We’ve been surprised before after thinking that we solved the problem, so I don’t want to count my chickens too soon. But this seems promising for now.
EGI said:
It is curious that the keyboard (USB) handling code would foul up ethernet communication but not out of the realm of possibility. In the example MFF file the experiment fails during the synchronization communication-The “A” for attention should be followed by the “N” (NTPSynch)command There is no “N” call sample file, there is a read error. This is seen in the log file inside the MFF. This is the one place in the ECI communication where timing is essential as the receiving of the NTPSynch call must be directly after the attention call, perhaps the keyboard handling is interrupting that. It is also curious that the PTB keyboard handling code would be a problem as we don’t see this issue in PTB. That would lead me to believe the issue is not just the PTB keyboard handling but also some interaction the keyboard code and something else. So, I share your unease about the solution.
They suggested I reach out to the broader PsychoPy community, particularly those who have experience working with the EGI systems. Has anyone ever seen anything like this? Wanting to get this figured out for everyone, not just us.
Many thanks in advance!