PDF文件的提取作业失败



我无法处理存储在s3桶中的pdf文件。我正在使用下面的代码库。

https://github.com/aws-samples/amazon-textract-code-samples/blob/master/python/12-pdf-text.py

错误详细信息:

已启动id为43950fhihfe0r94th34hf0934hf349hg034fh9304fj90349gh349f的任务作业状态为FAILED回溯(最近一次调用):文件"C:/Users/hima459004/PycharmProjects/testproject/text .py",第62行查询resultPage['Blocks']中的item:KeyError:"块"结果集页面收到1

进程结束,退出代码1

在访问resultPage json/dict变量中的Blocks key前检查

for resultPage in response:
if 'Blocks' in resultPage.keys():
for item in resultPage["Blocks"]:
if item["BlockType"] == "LINE":
print ('33[94m' +  item["Text"] + '33[0m')

最新更新