0

I am using a Kubernetes python client package for hitting Kubernetes APIs: https://github.com/kubernetes-client/python

Till now i was using Python 3.6 and this package was working. Now our environment is changed from Python 3.6 to Python 3.7 and while using the same package, i am getting below error while importing this client:

    from kubernetes import client
  File "/usr/local/lib/python3.7/site-packages/kubernetes/__init__.py", line 19, in <module>
    import kubernetes.client
  File "/usr/local/lib/python3.7/site-packages/kubernetes/client/__init__.py", line 540, in <module>
    from .apis.admissionregistration_api import AdmissionregistrationApi
  File "/usr/local/lib/python3.7/site-packages/kubernetes/client/apis/__init__.py", line 4, in <module>
    from .admissionregistration_api import AdmissionregistrationApi
  File "/usr/local/lib/python3.7/site-packages/kubernetes/client/apis/admissionregistration_api.py", line 120
    async=params.get('async'),
        ^
SyntaxError: invalid syntax

Is it possible to resolve this with any workaround?

1 Answer 1

1

async has become a keyword in Python 3.7, and it's not possible to assign to keywords and use them as variable names in general.

Quote from the docs:

Backwards incompatible syntax changes:

  • async and await are now reserved keywords.

You'll have to use a lower version of Python where it's not a keyword yet. You can also file a bug report to the devs of the library.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.