Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

HTTPError: Job in version "v1" cannot be handled as a Job: [pos 264]: json: expect char '"' but got char '{' #147

Open
cleverlzc opened this issue Nov 22, 2017 · 1 comment

Comments

@cleverlzc
Copy link

Traceback (most recent call last):
  File "/opt/xxx/RestApi.py", line 155, in createFunctionsJob
    k8shandle.createJob(imageName, imageName, request.json)
  File "/opt/xxx/k8shandle.py", line 298, in createJob
    pykube.Job(API, jobObj).create()
  File "/usr/local/lib/python2.7/dist-packages/pykube/objects.py", line 97, in create
    self.api.raise_for_status(r)
  File "/usr/local/lib/python2.7/dist-packages/pykube/http.py", line 106, in raise_for_status
    raise HTTPError(resp.status_code, payload["message"])
HTTPError: Job in version "v1" cannot be handled as a Job: [pos 264]: json: expect char '"' but got char '{'
@cleverlzc
Copy link
Author

cleverlzc commented Nov 22, 2017

I found this Exception raise position in the file of pykube/http.py:

    def raise_for_status(self, resp):
        try:
            resp.raise_for_status()
        except Exception:
            # attempt to provide a more specific exception based around what
            # Kubernetes returned as the error.
            if resp.headers["content-type"] == "application/json":
                payload = resp.json()
                if payload["kind"] == "Status":
                    raise HTTPError(resp.status_code, payload["message"])
            raise

But, I can not find why this error happened?

Anyone know why? Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant