Can anyone help me get around this? Thanks.
Fail:
Works, same type and value?
when you do the tag read, are you sure its “134” and not "134 " (with a space)?
Yeah, it might be interesting to print the len(raw)
you get in the version that fails.
or use
print repr(raw)
Is it always going to have a x02 prefix and x03 suffix?
Yes, its STX and ETX in the message.
Solved:
raw = system.tag.read("[EtikettTag]SICK/2112/Message").value
raw = raw.strip()
raw = raw[1:]
raw = raw[:-1]
If this is true you can use
raw.strip('\x02\x03')
Else you probably will want to use a regex pattern
import re
raw = re.sub("[^0-9]",'',raw)
raw[1:-1]
would work too.
Thanks all!