nifpga-python icon indicating copy to clipboard operation
nifpga-python copied to clipboard

Registers ending with a whitespace are not shown correctly on the registers.keys()

Open VicidominiLab opened this issue 3 years ago • 2 comments

When a FPGA LabView code has been compiled with a register with a name ending with a whitespace like( "MyRegister " ) is not correctly reported in session.registers.keys() . print(session.registers.keys()) shows a dict_keys(["MyRegister"]) instead of dict_keys(["MyRegister "])

and even if it is reported wrongly the session.registers["MyRegister"].write(0.0) throw an error KeyError("MyRegister")

VicidominiLab avatar Jul 07 '22 14:07 VicidominiLab

What version of python are you using?

I wasn't able to reproduce this, but when searching, I did find a few python bugs in different versions related to the xml parser handling whitespace incorrectly.

strainmike avatar Jul 28 '22 20:07 strainmike

Someone pointed out to me that the XML spec ignores leading and trailing whitespace in tags. Unfortunately LabVIEW just stores register names (including whitespace) without caring about that. Thats likely the issue.

Unfortunately I don't see any easy solutions or flags we could pass into the parser to always include the whitespace. I'm going to leave this issue open for now.

strainmike avatar Aug 10 '22 17:08 strainmike