Textrack - An error occurred (InvalidParameterException) when calling the AnalyzeDocument operation: Request has invalid parameters

0

Hi everyone, this is my first postQuestion, so im sorry if i broke any rule 😅. I try to extract some text from a PDF file and when the script run i have this message error with queries method analyze document. The thing is, the bucket is enable, the file exists in this path and the queries object are too simple. There is something on my syntax what be wrong or missing some params?

Error message An error occurred (InvalidParameterException) when calling the AnalyzeDocument operation: Request has invalid parameters

My boto3 version is 1.34.54

queries = [ {'Text': 'TextOnDoc', 'Alias': 'AliasName'} ]

TextrackClient.analyze_document(
      Document={'S3Object': {'Bucket': 'ActiveBucketName', 'Name': "folderOnBucket/file.pdf"}},
      FeatureTypes=["QUERIES"],
      QueriesConfig={ "Queries": queries }
)

if someone would be helpme, i really will preciate it I have seen some similar unanswered cases in the forum

Claudio Alvarez

profile picture
Claudio
已提問 7 個月前檢視次數 442 次
1 個回答
1
已接受的答案

Hello.

I looked at the documentation below and I thought your Python code was correct.
If possible, why not try using a different version of Boto3?
It is possible that changing the version may resolve the issue.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/textract/client/analyze_document.html

By the way, were there any other error messages output?
For example, can you check if there are any messages stating that there is a problem with a particular parameter?

profile picture
專家
已回答 7 個月前
profile picture
專家
已審閱 7 個月前
  • I'll try made a downgrade of boto3 and run the same script. For the other hand i try configured cloudwatch logs in My aws console but i failed ajjajaj 🫠 just to know where textract has the conflict

    Thanks for your answer

  • Hi Riku, after some hours ajajaj i solved this issue about the invalid params. The thing is the document are in Spanish and some Text inside the queries object have a special character like "á". I just remove from the text and it works

    Again, thanks for your support :)

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南