OS (e.g. Win10): Windows 10
PsychoPy version (e.g. 2024.2.4 Py 3.8): 2024.2.4
What are you trying to achieve?: I want to create a LSL stream in order to send markers to my fNIRS recording software.
What did you try to make it work?:
I initialized and broadcasted the stream with the following code:
import pylsl
info = pylsl.StreamInfo(name='PsychoPy_LSL', type='Markers', channel_count=1, nominal_srate=0, channel_format='string', source_id='psy_marker')
outlet = pylsl.StreamOutlet(info) # broadcast the stream
From what I found when I researched, this is a correct code and it does work.
However, I always get the following error message in the runner and I cannot find out what it actually means:
Exception in thread Thread-22:
Traceback (most recent call last):
File "C:\Program Files\PsychoPy\lib\threading.py", line 1016, in bootstrap_inner
self.run()
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\jobs.py", line135, in run
for pipeBytes in iter(self._fdpipe.readline, b''):
File "C:\Program Files\PsychoPy\lib\codecs.psy", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 1: invalid start byte
the number of position in the last line of the error message changes (here: 41). I’ve noticed 0, 1, 44, 47, and others as well. As does the number in the first line of the thread (here: Thread-22).
The experiment does not necessarily abort (but sometimes did! and then sometimes Psychopy as a whole closed) and does send the markers (and sometimes doesn’t!), but it definitely always freezes whenever I exit the experiment (be it, when I exit mid-session or after finishing the whole thing properly) and I feel like this has something to do with that error message. Freezing means in my case, that the I exit the experiment, but the runner freezes and I have to abort the whole PsychoPy setup and start it again to continue.
The message appears right after I broadcast the stream (outlet = pylsl.StreamOutlet(info)), before I send any markers.
What have you tried so far?: I checked for the standard coding (sys.getdefaultencoding(), it’s utf-8), for the current version of pylsl (1.16.2), removed the ‘_’ in my variable names, used different formats for channel_format.
It would be greatly appreciated if anyone knew what is happening here! Since it did work (except for the part when the experiment freezes at the end), we started testing already…