Open
Description
if type(c) == bytes and sys.version_info > (3,):
temp = ""
for i in c:
temp += chr(i)
c = temp
It seems that if we switch the read bytes to str
then they will never compare equal to the bytes
(byte string) below. Why are we trying to work with str
in py3 at all for generic incoming bytes? Sure, occasionally we'll want to decode some bytes to a string but not every byte and not with chr()
normally.
pysunspec/sunspec/core/client.py
Line 229 in 5242ea9
The original symptom is:
Traceback (most recent call last):
File "/home/altendky/st.pysunspec/Pysunspec_demo.py", line 188, in <module>
sys.exit(main(sys.argv[1:]))
File "/home/altendky/st.pysunspec/Pysunspec_demo.py", line 122, in main
d = sunspec.core.client.SunSpecClientDevice(**client_args)
File "/home/altendky/pysunspec/sunspec/core/client.py", line 775, in __init__
self.device.scan(progress=scan_progress, delay=scan_delay)
File "/home/altendky/pysunspec/sunspec/core/client.py", line 283, in scan
raise SunSpecClientError(error)
sunspec.core.client.SunSpecClientError: Device responded - not SunSpec register map
Despite having gotten a response starting with SunS
for base address 0
.
Metadata
Metadata
Assignees
Labels
No labels