Saigesp / json-translate

Translate json files with DeepL or AWS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting AWS related errors when attempting to use DeepL

federicogomezlara opened this issue · comments

Hello, I'm getting AWS related errors when I try to use this package with DeepL

When running json_translate deepl locales/common/en.json en-GB

I get the following error

json_translate aws locales/common/en.json en-GB
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/json_translate", line 5, in <module>
    from json_translate.commands import main
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/json_translate/commands.py", line 12, in <module>
    from translators import get_translator
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/json_translate/translators/__init__.py", line 3, in <module>
    from .aws import AWSTranslator
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/json_translate/translators/aws.py", line 11, in <module>
    class AWSTranslator(BaseTranslator):
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/json_translate/translators/aws.py", line 14, in AWSTranslator
    client = boto3.client(
             ^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/boto3/__init__.py", line 92, in client
    return _get_default_session().client(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/boto3/session.py", line 299, in client
    return self._session.create_client(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/botocore/session.py", line 997, in create_client
    client = client_creator.create_client(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/botocore/client.py", line 159, in create_client
    client_args = self._get_client_args(
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/botocore/client.py", line 490, in _get_client_args
    return args_creator.get_client_args(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/botocore/args.py", line 100, in get_client_args
    final_args = self.compute_client_args(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/botocore/args.py", line 219, in compute_client_args
    endpoint_config = self._compute_endpoint_config(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/botocore/args.py", line 368, in _compute_endpoint_config
    return self._resolve_endpoint(**resolve_endpoint_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/botocore/args.py", line 473, in _resolve_endpoint
    return endpoint_bridge.resolve(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/botocore/client.py", line 595, in resolve
    resolved = self.endpoint_resolver.construct_endpoint(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/botocore/regions.py", line 229, in construct_endpoint
    result = self._endpoint_for_partition(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/botocore/regions.py", line 277, in _endpoint_for_partition
    raise NoRegionError()
botocore.exceptions.NoRegionError: You must specify a region.

Googling the first thing that comes up is AWS related, as the error is (https://stackoverflow.com/questions/40377662/boto3-client-noregionerror-you-must-specify-a-region-error-only-sometimes)

I've never really used Python so maybe it's me doing something wrong, forgive if me so... I've tried defining the environment variables in an .env file at the root of my project, at the root of the json_translate folder, in my zhsrc, so far nothing has worked.

API key is definetely valid aswell

Hey @federicogomezlara

Have you specified the AWS region? The error says: botocore.exceptions.NoRegionError: You must specify a region.

You must define it with the env variable AWS_REGION_NAME. Example:

AWS_REGION_NAME=eu-west-1