question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing comma breaks cosmos.azure.aio.CosmosClient.from_connection_string()

See original GitHub issue
  • Package Name: azure-cosmos
  • Package Version: 4.3.0b1
  • Operating System:
  • Python Version: 3.9

Describe the bug A comma is missing at the end of line 162: https://github.com/Azure/azure-sdk-for-python/blob/9eca55e1f80bbfdbc7283374b9e5f63bc266ac4b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/cosmos_client.py#L159-L164

This results in python trying to use the ** operator on a string and a dict and it throws an exception.

To Reproduce

  1. Call the function cosmos.aure.aio.CosmosClient.from_connection_string()

Expected behavior The function should not throw an exception

Additional context Full stack trace:

[2022-01-14T19:46:15.342Z] Exception: TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'dict'
[2022-01-14T19:46:15.342Z] Stack:   File "/usr/local/Cellar/azure-functions-core-tools@4/4.0.3971/workers/python/3.9/OSX/X64/azure_functions_worker/dis
patcher.py", line 305, in _handle__function_load_request
[2022-01-14T19:46:15.342Z]     func = loader.load_function(
[2022-01-14T19:46:15.342Z]   File "/usr/local/Cellar/azure-functions-core-tools@4/4.0.3971/workers/python/3.9/OSX/X64/azure_functions_worker/utils/wrap
pers.py", line 40, in call
[2022-01-14T19:46:15.342Z]     return func(*args, **kwargs)
[2022-01-14T19:46:15.342Z]   File "/usr/local/Cellar/azure-functions-core-tools@4/4.0.3971/workers/python/3.9/OSX/X64/azure_functions_worker/loader.py"
, line 85, in load_function
[2022-01-14T19:46:15.342Z]     mod = importlib.import_module(fullmodname)
[2022-01-14T19:46:15.342Z]   File "/Users/trutkin/.asdf/installs/python/3.9.7/lib/python3.9/importlib/__init__.py", line 127, in import_module
[2022-01-14T19:46:15.342Z]     return _bootstrap._gcd_import(name[level:], package, level)
[2022-01-14T19:46:15.342Z]   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
[2022-01-14T19:46:15.342Z]   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
[2022-01-14T19:46:15.342Z]   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
[2022-01-14T19:46:15.342Z]   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
[2022-01-14T19:46:15.342Z]   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
[2022-01-14T19:46:15.342Z]   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
[2022-01-14T19:46:15.342Z]   File "/Users/trutkin/src/udm_v2/src/function_apps/projection_handler/projection_handler/__init__.py", line 35, in <module>
[2022-01-14T19:46:15.342Z]     cosmos_client = CosmosClient.from_connection_string(DOCUMENTDB_CONNSTR)
[2022-01-14T19:46:15.342Z]   File "/Users/trutkin/src/udm_v2/src/function_apps/projection_handler/.venv/lib/python3.9/site-packages/azure/cosmos/aio/co
smos_client.py", line 180, in from_connection_string
[2022-01-14T19:46:15.342Z]     consistency_level=kwargs.get("consistency_level", "Session") ** kwargs,
[2022-01-14T19:46:15.342Z] .

Running a linter on python code is very helpful for catching these sort of issues.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
PramodValavala-MSFTcommented, Feb 9, 2022

@taybin This has been fixed in #22536. Closing.

1reaction
simorenohcommented, Jan 18, 2022

Hi @taybin, thank you for pointing this out, a PR has been made to take care of this and should be released soon: https://github.com/Azure/azure-sdk-for-python/pull/22536

Since you’re testing out our async client, do let us know if you run into anything else so we can take a look! Hope you have a nice day!

Read more comments on GitHub >

github_iconTop Results From Across the Web

azure.cosmos.aio.CosmosClient class - Microsoft Learn
A client-side logical representation of an Azure Cosmos DB account. Use this client to configure and execute requests to the Azure Cosmos DB...
Read more >
The connection string is missing a required property ...
Azure.Cosmos.Client, Version=3.11.0.0 - How to fix it? The connection string from the account looks like (AccountEndpoint is missing:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found