【问题标题】:Python TypeError: 'bytes' object cannot be interpreted as an integer. How to add 'bytes'?Python TypeError:“字节”对象不能解释为整数。如何添加“字节”?
【发布时间】:2021-11-11 18:13:15
【问题描述】:

我在使用保存时收到错误TypeError: 'bytes' object cannot be interpreted as an integer,如何才能使它正确?

我想保存在同一张图片中,而不是创建一个新的。

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

如何添加“字节”? Documentation 什么都没说?

【问题讨论】:

  • 将错误的完整回溯显示为问题中格式正确的文本。

标签: python image image-processing iptc iptcinfo


【解决方案1】:

我之前没有使用过这个特定的包,但我认为关键字应该是一个python列表(我可能错了)

您是否尝试过像这样在关键字周围添加方括号?

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-01-26
    • 1970-01-01
    • 1970-01-01
    • 2020-06-19
    • 1970-01-01
    • 2017-08-01
    • 2021-07-30
    相关资源
    最近更新 更多