Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我在Windows下运行python程序遇到了问题 #127

Open
c2503175756 opened this issue Dec 29, 2024 · 4 comments
Open

我在Windows下运行python程序遇到了问题 #127

c2503175756 opened this issue Dec 29, 2024 · 4 comments

Comments

@c2503175756
Copy link

请求参数如下:

{
    "cmd": [
        {
            "args": [
               "C:\\Users\\25031\\AppData\\Local\\Programs\\Python\\Python39\\python.exe",
                "main.py"
            ],
            "env": [
                "PATH=C:\\Users\\25031\\AppData\\Local\\Programs\\Python\\Python39"
            ],
            "files": [{
                	"content":""
           		 },
                {
                    "name": "stdout",
                    "max": 10240
                },
                {
                    "name": "stderr",
                    "max": 10240
                }
            ],
            "cpuLimit": 3000000000,
            "clockLimit": 4000000000,
            "memoryLimit": 104857600,
            "procLimit": 50,
            "cpuRate": 0.1,
            "copyIn": {
                "main.py": {
                    "content": "print(\"hello world!\")"
                }
            }
        }
    ]
}

返回如下

[
  {
    "status": "Nonzero Exit Status",
    "exitStatus": 1,
    "time": 15625000,
    "memory": 8962048,
    "runTime": 0,
    "files": {
      "stderr": "Fatal Python error: _Py_HashRandomization_Init: failed to get random numbers to initialize Python\nPython runtime state: preinitialized\n\n",
      "stdout": ""
    }
  }
]

请问我应该如何修改该错误呢?

@criyle
Copy link
Owner

criyle commented Dec 30, 2024

@c2503175756
Copy link
Author

非常感谢你的帮助!我已经成功解决了问题

@c2503175756
Copy link
Author

c2503175756 commented Dec 31, 2024

很抱歉,我现在还需要麻烦你一下,我在运行Java程序时又遇到了点问题,显示为JVM在分配内容时遇到了问题,请问我应该在哪里修改呢?还是因为我的请求参数写的有问题呢?
请求参数如下:

{
  "cmd": [
    {
      "args": [
        "C:/ProgramData/Oracle/Java/jdk-11.0.19/bin/javac.exe","Main.java"
      ],
      "env": [
        "PATH=C:/ProgramData/Oracle/Java/jdk-11.0.19/bin"
      ],
      "files": [
        {
          "content": ""
        },
        {
          "name": "stdout",
          "max": 10240
        },
        {
          "name": "stderr",
          "max": 10240
        }
      ],
      "cpuLimit": 10000000000,
      "memoryLimit": 104857600,
      "procLimit": 50,
      "copyIn": {
        "Main.java": {
          "content": "public class Main {\npublic static void main(String[] args) {\n System.out.println('aaa');\n }\n}"
        }
      },
      "copyOut": [
        "stdout",
        "stderr"
      ],
      "copyOutCached": []
    }
  ]
}

返回如下:

[
  {
    "status": "Memory Limit Exceeded",
    "exitStatus": 1,
    "time": 1359375000,
    "memory": 105844736,
    "runTime": 0,
    "files": {
      "stderr": "",
      "stdout": "#\n# There is insufficient memory for the Java Runtime Environment to continue.\n# Native memory allocation (malloc) failed to allocate 1048576 bytes for AllocateHeap\n# An error report file with more information is saved as:\n# C:\\Users\\25031\\AppData\\Local\\Temp\\es4127719768\\hs_err_pid1636.log\n"
    }
  }
]

@criyle
Copy link
Owner

criyle commented Dec 31, 2024

Java 需要更大的内存限制,尝试增加 memoryLimit 的大小

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

No branches or pull requests

2 participants