kubernetes-client / python-base

Apache License 2.0
70 stars 185 forks source link

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 #245

Closed tchelovilar closed 2 years ago

tchelovilar commented 3 years ago

Hi, I got a decode error using the function w.stream to get the log stream:

https://github.com/kubernetes-client/python-base/blob/0d4f822f4f654361764a6f8dcf7ca9bf5bbce3f9/watch/watch.py#L58

Follow the traceback:

  0%|          | 0/200286 [00:00<?, ?it/s]Warning : `load_model` does not return WordVectorModel or SupervisedModel any more, but a `FastText` object which is very similar.
Traceback (most recent call last):
  File "_model-train-and-release-cicd/auto-anubis/follow-job.py", line 135, in <module>
    main()
  File "_model-train-and-release-cicd/auto-anubis/follow-job.py", line 91, in main
    for line in w.stream(
  File "/usr/local/lib/python3.8/dist-packages/kubernetes/watch/watch.py", line 165, in stream
    for line in iter_resp_lines(resp):
  File "/usr/local/lib/python3.8/dist-packages/kubernetes/watch/watch.py", line 58, in iter_resp_lines
    seg = seg.decode('utf8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 32767: unexpected end of data

Thank you in advance :)

roycaihw commented 3 years ago

/assign

roycaihw commented 3 years ago

Could you share more of your code and what log stream you were getting?

tchelovilar commented 3 years ago

Hi @roycaihw ,

Thank you for your time.

This is the snippet of the code that I use to follow the log:

        w = watch.Watch()
        start_time = time()

        try:
            for line in w.stream(
                func=k8s.read_namespaced_pod_log,
                name=POD_NAME,
                namespace=NAMESPACE,
                follow=True,
            ):
                print(line)
                if (time() - start_time) > int(FOLLOW_LOG_TIME):
                    w.stop()
        except UnicodeDecodeError as error:
            print(error)

Follow a copy of the log, the problem happens at line 17: https://github.com/tchelovilar/test-actions/blob/master/log2#L17

And the last traceback:

  0%|          | 0/200286 [00:00<?, ?it/s]
  0%|          | 0/200286 [00:00<?, ?it/s]
Warning : `load_model` does not return WordVectorModel or SupervisedModel any more, but a `FastText` object which is very similar.

  0%|          | 0/200286 [00:00<?, ?it/s]
Warning : `load_model` does not return WordVectorModel or SupervisedModel any more, but a `FastText` object which is very similar.
Warning : `load_model` does not return WordVectorModel or SupervisedModel any more, but a `FastText` object which is very similar.

  0%|          | 0/200286 [00:00<?, ?it/s]
  0%|          | 0/200286 [00:00<?, ?it/s]
  0%|          | 0/200286 [00:00<?, ?it/s]
Warning : `load_model` does not return WordVectorModel or SupervisedModel any more, but a `FastText` object which is very similar.
'utf-8' codec can't decode bytes in position 32766-32767: unexpected end of data
k8s-triage-robot commented 3 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

k8s-ci-robot commented 2 years ago

@k8s-triage-robot: Closing this issue.

In response to [this](https://github.com/kubernetes-client/python-base/issues/245#issuecomment-997387277): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues and PRs according to the following rules: >- After 90d of inactivity, `lifecycle/stale` is applied >- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied >- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed > >You can: >- Reopen this issue or PR with `/reopen` >- Mark this issue or PR as fresh with `/remove-lifecycle rotten` >- Offer to help out with [Issue Triage][1] > >Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). > >/close > >[1]: https://www.kubernetes.dev/docs/guide/issue-triage/ Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.