Open GoogleCodeExporter opened 8 years ago
There is a small typo in the last line of the above code. It should read:
chans_xml.append(chans_xml[-1].next_sibling(name="channel"))
The problem is that next_sibling is returning XMLElement(None), so it is always
returning an XMLElement. Is that the desired behaviour? Am I expected to check
to see if the returned XMLElement is not empty? Or would it be better if
next_sibling returned None if nothing is found?
There might be a more general solution, but for now I modified pylsl.py as
follows:
def next_sibling(self,name=None):
"""Get the next sibling in the children list of the parent node.
If a name is provided, the next sibling with the given name is returned.
"""
if name is None:
handle = lib.lsl_next_sibling(self.e)
else:
handle = lib.lsl_next_sibling_n(self.e,name)
return XMLElement(handle) if handle else handle
Original comment by chadwick...@gmail.com
on 16 Jun 2015 at 6:58
Original issue reported on code.google.com by
chadwick...@gmail.com
on 16 Jun 2015 at 5:20