Running wrapper {"command": "/opt/conda/bin/python3 -u /opt/nuclio/_nuclio_wrapper.py --handler main:handler --socket-path /tmp/nuclio-rpc-cipbe4b85k6ne6scq1gg.sock --platform-kind local --namespace nuclio --worker-id 0 --trigger-kind http --trigger-name myHttpTrigger --decode-event-strings"} /opt/nuclio/_nuclio_wrapper.py:395: DeprecationWarning: There is no current event loop loop = asyncio.get_event_loop() {"datetime": "2023-07-15 15:11:13,541", "level": "error", "message": "Caught unhandled exception while initializing", "with": {"err": "'return' outside function (main.py, line 64)", "traceback": "Traceback (most recent call last):\n File \"/opt/nuclio/_nuclio_wrapper.py\", line 400, in run_wrapper\n wrapper_instance = Wrapper(root_logger,\n File \"/opt/nuclio/_nuclio_wrapper.py\", line 71, in __init__\n self._entrypoint = self._load_entrypoint_from_handler(handler)\n File \"/opt/nuclio/_nuclio_wrapper.py\", line 195, in _load_entrypoint_from_handler\n module = __import__(module_name)\n File \"/opt/nuclio/main.py\", line 64\n return context.Response(body=json.dumps(results), headers={},\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nSyntaxError: 'return' outside function\n", "worker_id": "0"}} 23.07.15 15:11:13.550 sor.http.w0.python.logger (E) Unexpected termination of child process {"error": null, "status": "exit status 1"} panic: Wrapper process for worker 0 exited unexpectedly with: exit status 1 goroutine 13 [running]: github.com/nuclio/nuclio/pkg/processor/runtime/rpc.(*AbstractRuntime).watchWrapperProcess(0xc0007f4300) /nuclio/pkg/processor/runtime/rpc/abstract.go:471 +0x445 created by github.com/nuclio/nuclio/pkg/processor/runtime/rpc.(*AbstractRuntime).startWrapper /nuclio/pkg/processor/runtime/rpc/abstract.go:244 +0x1c5 /nuclio/pkg/platform/local/platform.go:1168 Failed to deploy function ...//nuclio/pkg/platform/abstract/platform.go:197
时间: 2023-08-05 09:05:07 浏览: 189
根据你提供的日志,出现了一些错误和异常。主要的错误是在`main.py`文件的第64行,出现了`SyntaxError: 'return' outside function`的语法错误。这意味着在函数外部使用了`return`关键字,导致语法错误。
请确保在你的代码中,`return`语句只在函数内部使用。如果你想在函数外部返回结果,可以考虑使用其他方式,例如将结果存储在全局变量中或者使用其他适当的方法。
另外,还有一些其他的警告和错误,包括`DeprecationWarning: There is no current event loop`警告和`Unexpected termination of child process`错误。这些错误可能与代码的其他部分有关,建议仔细检查代码并确保正确处理和捕获异常。
最后,根据日志的最后一行,显示了一个`Failed to deploy function`的错误消息,这可能意味着函数部署失败。可能需要进一步调试和检查代码、依赖项以及部署环境的配置。
希望这些信息对你有帮助。如果你需要进一步的帮助,请提供更多的上下文和代码细节。
相关问题
Running wrapper {"command": "/usr/bin/python3 -u /opt/nuclio/_nuclio_wrapper.py --handler main:handler --socket-path /tmp/nuclio-rpc-ciqpet32hcd16v3tbm3g.sock --platform-kind local --namespace nuclio --worker-id 0 --trigger-kind http --trigger-name myHttpTrigger --decode-event-strings"} 2023-07-18 03:33:10 {"datetime": "2023-07-17 19:33:10,482", "level": "error", "message": "Caught unhandled exception while initializing", "with": {"err": "No module named 'skimage'", "traceback": "Traceback (most recent call last):\n File "/opt/nuclio/_nuclio_wrapper.py", line 400, in run_wrapper\n wrapper_instance = Wrapper(root_logger,\n ^^^^^^^^^^^^^^^^^^^^\n File "/opt/nuclio/_nuclio_wrapper.py", line 71, in init\n self._entrypoint = self._load_entrypoint_from_handler(handler)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/opt/nuclio/_nuclio_wrapper.py", line 195, in _load_entrypoint_from_handler\n module = import(module_name)\n ^^^^^^^^^^^^^^^^^^^^^^^\n File "/opt/nuclio/main.py", line 8, in <module>\n from skimage.measure import approximate_polygon, find_contours\nModuleNotFoundError: No module named 'skimage'\n", "worker_id": "0"}} 2023-07-18 03:33:10 23.07.17 19:33:10.896 sor.http.w0.python.logger (E) Unexpected termination of child process {"error": null, "status": "exit status 1"}
根据您提供的信息,看起来在运行过程中出现了一个错误。错误信息显示找不到名为'skimage'的模块。这可能是因为缺少了该模块或者模块未正确安装。
为了解决这个问题,您可以尝试安装'skimage'模块。可以使用以下命令来安装:
```
pip install scikit-image
```
如果您已经安装了该模块,那么可能是因为它没有正确导入。请确保在代码中正确导入'skimage'模块,例如:
```python
from skimage.measure import approximate_polygon, find_contours
```
确保在代码中引入模块后重新运行程序,这样应该就可以解决该错误。
Exception caught in handler {"worker_id": "0", "exc": "'Detections' object has no attribute 'xy'", "traceback": "Traceback (most recent call last):\n File \"/opt/nuclio/_nuclio_wrapper.py\", line 118, in serve_requests\n await self._handle_event(event)\n File \"/opt/nuclio/_nuclio_wrapper.py\", line 312, in _handle_event\n entrypoint_output = self._entrypoint(self._context, event)\n File \"/opt/nuclio/main.py\", line 37, in handler\n masks = detections.xy\nAttributeError: 'Detections' object has no attribute 'xy'\n"}
根据你提供的异常信息,代码中的 `Detections` 对象没有 `xy` 属性,导致了 `'Detections' object has no attribute 'xy'` 的错误。
根据异常信息,错误发生在 `main.py` 文件的第37行,尝试访问 `detections.xy` 属性。但是,根据错误消息,`Detections` 对象并没有 `xy` 属性。
要解决这个问题,你需要检查 `Detections` 类的定义并确保它确实具有 `xy` 属性。如果你是使用第三方库或模块中的 `Detections` 类,可以查阅其文档或示例代码,了解如何正确使用该对象及其属性。
如果你自己定义了 `Detections` 类,那么可能是在代码中的其他地方出现了问题。你可以检查 `Detections` 类的实现并确保在需要时定义了 `xy` 属性。
总之,问题出现在访问 `Detections` 对象的 `xy` 属性上,而该属性在对象中没有定义。请检查代码中的 `Detections` 类,并确保它具有所需的属性或者使用正确的属性访问方式。
如果你需要更详细的帮助,请提供相关代码的更多细节。
阅读全文