Open fusiller opened 4 years ago
Hello, a few glitches I came across trying to run the sample with Python 3 that could be solved as follows :
from io import BytesIO
elif (size >= 2) and (data[0] == 0o377 and data[1] == 0o330):
jpeg = BytesIO(data)
try: #pictdata = open(pict_dir + "/" + picture).read() pictdata = open(pict_dir + "/" + picture, 'rb').read()
After doing this you should be fine. Regards Alex
PS (sorry for not being a good github user and not being able to create a pull request)
Hello, a few glitches I came across trying to run the sample with Python 3 that could be solved as follows :
from cStringIO import StringIO (no more cStringIO in Python3)
from io import BytesIO
handling JPEGs
elif (size >= 2) and (data[:2] == '\377\330'): (binary file read and byte per bate comparison)
elif (size >= 2) and (data[0] == 0o377 and data[1] == 0o330):
jpeg = StringIO(data)
in the main we need to open in binary mode. If not, reading jpeg files (or any non text) will jump to except: and continue
After doing this you should be fine. Regards Alex
PS (sorry for not being a good github user and not being able to create a pull request)