使用包含特殊符号的文档文件名进行文本检测时报错。

0

【以下的问题经过翻译处理】 你好, 我正在尝试使用textract从存储在S3存储桶中的pdf中提取文本。

response = textract.start_document_text_detection(
DocumentLocation={
    'S3Object': {
        'Bucket': '样本存储桶',
        'Name': '扫描_pdf_#1.pdf'
    }
},
JobTag = '扫描_pdf_#1.pdf_job',
NotificationChannel={
    'RoleArn': 'arn:aws:iam::*******:role/AWSSNSFullAccessRole',
    'SNSTopicArn': 'arn:aws:sns:us-east-1:*********:PDF_TextProcess_Completed'
})

这里,当文件名包含特殊符号时,会出现以下错误

InvalidParameterException: An error occurred (InvalidParameterException) when calling the StartDocumentTextDetection operation: Request has invalid parameters

我该如何在不更改文件名称的情况下解决这个问题?

我也尝试过以下方法,但它没有起作用 ‘’‘ file = urllib.parse.unquote_plus(file, encoding='utf-8') ’‘’

profile picture
전문가
질문됨 9달 전33회 조회
1개 답변
0

【以下的回答经过翻译处理】 你好,感谢使用Amazon Textract。根据文档https://docs.aws.amazon.com/textract/latest/dg/API_StartDocumentTextDetection.html,参数JobTag只允许以下字符: 类型:字符串 长度限制:最小长度为1,最大长度为64。 模式:[[a-zA-Z0-9_.-:]+]

请提供有效的JobTag值并重试请求。

profile picture
전문가
답변함 9달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠