Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'list' object has no attribute 'get' #2223

Closed
creatorrr opened this issue Jun 4, 2021 · 2 comments · Fixed by #2225
Closed

AttributeError: 'list' object has no attribute 'get' #2223

creatorrr opened this issue Jun 4, 2021 · 2 comments · Fixed by #2225
Labels
bug Something isn't working
Milestone

Comments

@creatorrr
Copy link

Version

0.35.0

Description

Inside a python repl on a running pod, trying to create a cortex client throws an error. I know this is not a typical or expected usage of the sdk but thought I'd report it. If irrelevant, please close the issue.

Steps to reproduce

  1. kubectl exec ... bash into a running pod
  2. python
  3. >>> import cortex; cortex.client()

Stack traces

>>> import cortex
>>> cl = cortex.client()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/envs/env/lib/python3.6/site-packages/cortex/telemetry.py", line 106, in wrapper
    return func(*args, **kwargs)
  File "/opt/conda/envs/env/lib/python3.6/site-packages/cortex/__init__.py", line 38, in client
    if not environments.get("default_environment"):
AttributeError: 'list' object has no attribute 'get'

Additional context

(optional)

Suggested solution

Seems to be a problem in cortex/init.py#L38.

@deliahu
Copy link
Member

deliahu commented Jun 4, 2021

@creatorrr Thanks for bringing this to our attention!

I've made the fix here, and it will be in our next release (scheduled for early next week).

That said, if it had behaved as expected, it would have hit the next line which would have returned the correct error message: "no default environment configured".

Since you are running inside of a Cortex cluster, there exists a CLI configuration ready to go; you can configure your CLI to use it by exporting CORTEX_CLI_CONFIG_DIR=/mnt/client before using your client. In our next release, this env var will automatically be set, so you won't have to manually export it in the future.

If you weren't in a Cortex cluster, you would instead use the cortex.new_client(name, operator_endpoint) constructor.

@deliahu deliahu added this to the v0.36 milestone Jun 7, 2021
@deliahu
Copy link
Member

deliahu commented Jun 8, 2021

This fix has now been released in v0.36 (changelog)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants