u''
is the repr
string-formatted output of an empty string, which is falsey in Python, but distinctly different from the None
singleton - so you can either:
- Change your loop condition to check against 'truth' of a value, so empty strings, empty collections, None,
0
, and booleanFalse
will all fail the condition:
read = system.tag.read("path").value
if read:
# it was truthy
else:
# it was falsey
- Check for the empty string explicitly in your loop condition:
read = system.tag.read("path").value
if read == "":
# it was truthy
else:
# it was falsey