langgenius / dify-sandbox

A lightweight, fast, and secure code execution environment that supports multiple programming languages
https://docs.dify.ai/development/backend/sandbox
Apache License 2.0
434 stars 97 forks source link

NameError: name 'main' is not defined #46

Open it-xiaomi opened 3 months ago

it-xiaomi commented 3 months ago

The code execution nodes in the workflow can run normally, but the same code cannot be executed by the code interpreter in the tool,error info:{"simple_code": "tool invoke error: Traceback (most recent call last):\n File \"/var/sandbox/sandbox-python/tmp/d9bd9eb0_ae26_4744_a99a_e6406d7d85eb.py\", line 48, in \n File \"\", line 6, in \nNameError: name 'main' is not defined\nerror: exit status 255\n"}

DirtyRattie commented 1 day ago

Functions in dify code runner can only be named "main", is this the problem by any chance?