Open GoogleCodeExporter opened 9 years ago
Maybe this is relevant:
http://stackoverflow.com/questions/12482364/ctypes-class-member-access-segfaulti
ng
That would explain why lib.lsl_create_streaminfo works (its arguments are
wrapped in ctypes) but none of the other calls to lib do.
Original comment by chadwick...@gmail.com
on 3 Mar 2015 at 4:06
That did indeed fix it, at least partially. I can now SendData but I cannot
ReceiveData because I do not know how to specify dynamically sized buffers. If
I set the argtypes for the lib.lsl_pull_sample_f function then I get this error:
ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected
LP_c_float instance instead of pointer to c_float_Array_8
It might be necessary to cast the buffer to the correct pointer type when the
function is called.
See:
http://stackoverflow.com/questions/8392203/dynamic-arrays-and-structures-in-stru
ctures-in-python
Original comment by chadwick...@gmail.com
on 3 Mar 2015 at 7:04
It seems the file didn't get attached. Trying again. Here is the diff on
pylsl.py
Original comment by chadwick...@gmail.com
on 3 Mar 2015 at 7:04
Attachments:
I ended up casting the pointer/buffer when the buffer was created. I also had
to make a change to how pull_sample was reading the data. Now SendData,
ReceiveData, and ReceiveDataInChunks all work. Please take a look at the
changes to see if there is any expectation they will kill performance.
Cheers,
Chad
Original comment by chadwick...@gmail.com
on 3 Mar 2015 at 7:59
Attachments:
Thanks Chad for this excellent fix! Unfortunately, the fix on OSX seems to
break pylsl on Windows and Linux. I am currently in the process of finding the
exact source of the issue. Once this is resolved, I will incorporate these
changes into the current trunk.
Thank you, again. This is awesome -- RecorderLib64.dylib too.
Original comment by david.er...@gmail.com
on 4 Mar 2015 at 6:12
OK. So I have made one revision to Chad's version of pylsl.py. It seems that a
couple of lines got deleted from the original version and this change didn't
make into the change log for some reason. These are lines 305-307:
def handle(self):
"""Get the implementation handle."""
return self.obj
This should work in Windows and Linux with no problems. The test programs in
the LSL/liblsl-Python/examples folder all work perfectly on OSX, but I am still
getting a segfault when I run LabRecorder.py. This occurs when I stop recording
-- so this needs a little bit more investigation.
Original comment by david.er...@gmail.com
on 4 Mar 2015 at 8:29
Attachments:
I don't think I deleted those lines. Anyway, thanks for finding that.
I also have the segfault when stopping recording. My guess is that it is a
similar cause (argtypes) but in RecorderLib. Because it is in RecorderLib I
considered it to be a separate issue to this one.
Original comment by chadwick...@gmail.com
on 4 Mar 2015 at 8:44
Yeah, who knows how that happened. In any case, it was causing all kinds of
mischief. I am inclined to close this issue, but I wonder if the seg-faulting
in OSX can be stemmed with further revision to pylsl.py rather than
LabRecorder.py. Honestly, I am not (yet) expert enough on python to make that
judgment. Christian may be able to give a better idea about this. TBC...
Anyways, thanks again, Chad.
Original comment by david.er...@gmail.com
on 4 Mar 2015 at 9:05
Original issue reported on code.google.com by
chadwick...@gmail.com
on 11 Dec 2014 at 4:09