System tag read issue

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:

  1. Change your loop condition to check against 'truth' of a value, so empty strings, empty collections, None, 0, and boolean False will all fail the condition:
	read = system.tag.read("path").value
	if read:
		# it was truthy
	else:
		# it was falsey
  1. 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
1 Like