boto3_type_annotations icon indicating copy to clipboard operation
boto3_type_annotations copied to clipboard

Argument 1 to "client" has incompatible type "Literal['ecs']"; expected "Literal['dynamodb']"

Open MartinThoma opened this issue 4 years ago • 2 comments

I keep getting variations of this message, e.g.

Argument 1 to "client" has incompatible type "Literal['ecs']"; expected "Literal['dynamodb']"

or

Argument 1 to "client" has incompatible type "Literal['ecs']"; expected "Literal['dynamodb']"

MVCE

import boto3
from boto3_type_annotations.s3 import Client

s3_client: Client = boto3.client("s3")
s3_client.put_object(
    Body="foo: bar\n", Bucket="some_bucket_name", Key="some_key",
)

ssm_client: Client = boto3.client("ssm")
ssm_client.put_parameter(
    Name="some name", Value="foo: bar\n", Type="String", Overwrite=True,
)

gives:

$ python3.8 -m mypy . --ignore-missing-imports
foo.py:5: error: Argument 1 to "client" has incompatible type "Literal['s3']"; expected "Literal['dynamodb']"
foo.py:12: error: Argument 1 to "client" has incompatible type "Literal['ssm']"; expected "Literal['dynamodb']"
Found 2 errors in 1 file (checked 1 source file)

MartinThoma avatar Jul 03 '20 11:07 MartinThoma

This project is dead. Someone with more time than me has forked it, and made A LOT of improvements on it. Their repo is linked in the readme. However, if you need this fixed for a legacy app, feel free to put in a pull request, and I'll push it up to PyPI.

alliefitter avatar Jul 04 '20 21:07 alliefitter

Thank you for answering - now I see that you linked boto3-stubs

MartinThoma avatar Jul 05 '20 07:07 MartinThoma