AnsweredAssumed Answered

ArcSDESQLExecute error message contains unicode character

Question asked by blake.terhune on Jan 26, 2015
Latest reply on Jan 27, 2015 by bixb0012

If you execute an invalid SQL statement with arcpy.ArcSDESQLExecute(), it will return an error message with a unicode special character (see ArcSDESQLExecute_Error.gif). That unicode character in the error message actually causes an error with Python if you try to print the message (see PythonUnicode_Error.gif). Apparently this is a known Python issue.

 

I found you have to wrap the arcpy error message up in encoding so Python doesn't choke (haha).

except Exception as err:
        raise Exception(unicode(err.message).encode("utf-8"))

 

Why is this silly unicode character in an error message anyway? Has anyone else found a better way to deal with this?

Outcomes