关于 CYaRon 的运行时错误

灌水区

RyanLi @ 2023-08-05 02:17:52

在 M1 Mac 下的 Windows 11 虚拟机下执行 CYaRon 模块的 output_gen() 时会无法调用可执行文件,但可以生成输入文件和空的输出文件。例如,在运行官方给出的脚本范例(仅将 output_gen() 中的路径改为 C:\\Data.exe)时会抛出如下错误:

Traceback (most recent call last):
  File "[脚本的绝对路径].py", line 19, in <module>
    test_data.output_gen("C:\\Data.exe") # 标程编译后的可执行文件,不需要freopen等,CYaRon自动给该程序输入并获得输出作为.out
  File "C:\Users\[管理员用户名]\AppData\Roaming\Python\Python38\site-packages\cyaron\io.py", line 171, in output_gen
    subprocess.check_call(shell_cmd, shell=True, stdin=self.input_file, stdout=self.output_file, universal_newlines=True)
  File "C:\Users\[管理员用户名]\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'C:\Data.exe' returned non-zero exit status 1.

然而去掉 output_gen() 后不会报错,求解


by jifbt @ 2023-08-05 10:39:53

@RyanLi 文件 C:\Data.exe 存在吗


by RyanLi @ 2023-08-05 12:45:45

@jifbt 既然都改到这个路径了那肯定存在啊(


|