我一直在嘗試使用 python kubernetes API 來流式傳輸 kubernetes 日志的輸出。我計劃檢索日志并最終使用 Web Socket 來傳輸日志。from kubernetes import watch...def getLog(pod,namespace): w = watch.Watch() return w.stream(v1.read_namespaced_pod_log, name=pod, namespace=namespace)main(): result = getLog(pod, namespace) for line in result: print(line)但是我收到以下錯誤。Traceback (most recent call last): File "./kubernetes-project", line 176, in <module> main() File "...venv/lib/python3.6/site-packages/kubernetes/watch/watch.py", line 143, in stream yield self.unmarshal_event(line, return_type) File "...venv/lib/python3.6/site-packages/kubernetes/watch/watch.py", line 91, in unmarshal_event js['raw_object'] = js['object']TypeError: 'int' object is not subscriptable預(yù)期輸出應(yīng)低于。然而,日志一直在流式傳輸,直到128,。3是下一行的預(yù)期輸出。..."random_crop_size": [ 384, 128, **streaming stops here and error starts showing below** 3...我懷疑該錯誤可能是由于僅3將行轉(zhuǎn)換為int對象而不是字符串,因此watch無法處理它。知道如何解決這個問題嗎?
添加回答
舉報
0/150
提交
取消