aws-samples / aws-samples/amazon-textract-textractor
Issue with creating Textract client: NoRegionError thrown
- Dominant language
- Jupyter Notebook
- Stars
- 493
- Forks
- 163
- PR merge metrics
- No merged PRs in 30d
Description
Getting an error while initializing Textractor. I am passing the region_name parameter, yet I am still getting a NoRegionError from boto3. I identified the cause of this issue, in **textractor.py**, while initializing boto3 session, region name is being passed, if not None but while initializing the **textract** service, no region name is being passed and hence, boto3 raises the **NoRegion Error**. I fixed this by passing the region_name parameter while creating textract service as well.
I changed line 97 in textractor/textractor.py:
` if self.region_name is not None:
self.textract_client = self.session.client("textract", region_name=self.region_name)
else:
self.textract_client = self.session.client("textract")`
Seems to do the trick
I had setup my AWS CLI using access key and secret key.
Earlier, I had setup another profile using SSO, but when using that profile, I never received the no NoRegionError, this issue seems to be with my new profile.
Should I create a PR?
Contributor guide
Assessment
This issue has not been assessed yet.