Home > Blockchain >  Python TypeError: 'bytes' object cannot be interpreted as an integer. How to add 'byt
Python TypeError: 'bytes' object cannot be interpreted as an integer. How to add 'byt

Time:09-18

I got an error TypeError: 'bytes' object cannot be interpreted as an integer when I use save, what to do to make it right?

I want to save in same image, not to create a new one.

from iptcinfo3 import IPTCInfo
import sys
imagename = 'horse.jpg'
info = IPTCInfo(imagename)
info['keywords'] = 'horse', 'brown', 'animal', 'nature'
info.save()

How to add 'bytes'? Documentation doesn't say anything?

CodePudding user response:

I haven't used this specific package before, but I believe the keywords should be a python list (I may be wrong)

Have you tried adding square brackerts around the keywords, like this?

from iptcinfo3 import IPTCInfo
import sys
imagename = 'horse.jpg'
info = IPTCInfo(imagename)
info['keywords'] = ['horse', 'brown', 'animal', 'nature']
info.save()
  • Related