I was looking at the documentation and in the example section, I don't see how to create a UUID based on File Contents. Google did not help me either.
I've tried this:
>>> import uuid
>>> data = open('/media/emmc/DCIM/100ABC06/00059.JPG','rb')
>>> contents = data.read()
>>> len(contents)
9155
>>> uuid = uuid.UUID(contents)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/uuid.py", line 134, in __init__
ValueError: badly formed hexadecimal UUID string
Also this:
>>> uuid = uuid.UUID(str(contents))
>>> uuid = uuid.UUID(contents.decode('ascii'))
>>> uuid = uuid.UUID(contents.decode('utf8'))
Please help me understand how to generate a UUID based on File contents in Python 2.7.