I’m trying to convert a unicode object to a UUID with the uuid module. This is the code I’m using:
GUID = $unicode
GUID = uuid.UUID( GUID )
print 'should be an UUID object:'
print GUID
The problem is that GUID doesn’t convert…it just stays the same unicode even after running it through UUID(). Also, no error gets thrown. What is going on here?
From what I gather, your problem is that you get the UUID as a string. This is because you are using
print, which runsstr()on an object. Tryprint(repr(some_uuid)).Your assertion that
isinstance()returnsFalseisn’t reproducible on my end: