labstreaminglayer / pylsl

Python bindings (pylsl) for liblsl
MIT License
136 stars 57 forks source link

Linux two streams main thread creation #74

Closed LMBooth closed 8 months ago

LMBooth commented 8 months ago

Hi all, just a quick query about outlet creation on Linux.

I know there are some issues with Linux multithreading and the LSL, but throwing caution to the wind I've made a simple example where I'm attempting to make two outlets, one for setting marker information and the other for data, but when trying to create a second it seems to overwrite the first no matter the order, here's a simplified version which replicates the issue:

import pylsl

markerInfo = pylsl.StreamInfo("markers", "Markers", 1, 0, 'string', 'Dev')
markerOutlet = pylsl.StreamOutlet(markerInfo)
info = pylsl.StreamInfo("datatream", "EMG", 8, 250, 'float32', 'Dev')
chns = info.desc().append_child("channels")
for label in range(8):
    ch = chns.append_child("channel")
    ch.append_child_value("label", str(label+1))
    ch.append_child_value("type", "EMG")
outlet = pylsl.StreamOutlet(info)
streams = pylsl.resolve_streams()
for stream in streams:
    print(stream.name())
    print(stream.type())

Operating system: Ubuntu 22.04 Python version: 3.11.5 LSL version: 1.16.2

Any comments or suggestions of how to circumvent this issue would be greatly appreciated. (I've attempted multiprocessing but keep getting pickle errors in my more complex pybci PseudoDevice class )

LMBooth commented 8 months ago

Wait, silly me, i think i may have been missing libpugixml1v5

Just partitioned my home machine with a fresh install of Operating system: Ubuntu 22.04 Python version: 3.11.5 LSL version: 1.16.1 and lsllib.so 1.16.1 and this now prints both outlets, unsure if 1.16.2 has anything to do with it.