Closed Alice-Zero closed 6 years ago
Need more info
emm...原来是调试直接卡住了 稍微调试了一下,现在能跑出来了,但是对拍器只能获得std的输出,无法获得对拍程序的输出
from cyaron import *
while True:
input_io=IO()
input_io.input_writeln(randint(1, 100), randint(1, 100))
Compare.program("./a", input=input_io, std_program="./std")
程序a和std都是A+B output:
Traceback (most recent call last):
File "*/compare.py", line 5, in <module>
Compare.program("./std", input=input_io, std_program="./std")
File "*/python3.5/site-packages/cyaron/compare.py", line 144, in program
[x for x in map(do, programs)]
File "*/python3.5/site-packages/cyaron/compare.py", line 144, in <listcomp>
[x for x in map(do, programs)]
File "*/python3.5/site-packages/cyaron/compare.py", line 139, in do
cls.__compare_two(program_name, content, std, grader)
File "*/python3.5/site-packages/cyaron/compare.py", line 28, in __compare_two
raise CompareMismatch(name, info)
cyaron.compare.CompareMismatch: ('./a', TextMismatch('0\n', '48\n', 'On line {} column {}, read {}, expected {}.', 1, 1, '0', '48'))
CentOS Linux release 7.5.1804 (Core) Ubuntu 16.04.4 LTS 这两个系统上使用python2和3都得到了同样的结果
def do(program_name):
timeout = None
if list_like(program_name) and len(program_name) == 2 and int_like(program_name[-1]):
program_name, timeout = program_name
with open(os.dup(input.input_file.fileno()), 'r', newline='\n') as input_file:
if timeout is None:
#调试发现这一行获得content总是'0\n'
content = make_unicode(subprocess.check_output(program_name, shell=(not list_like(program_name)), stdin=input_file, universal_newlines=True))
else:
content = make_unicode(subprocess.check_output(program_name, shell=(not list_like(program_name)), stdin=input_file, universal_newlines=True, timeout=timeout))
cls.__compare_two(program_name, content, std, grader)
@lin714093880 need fix?
Unable to reproduce in newest build. Check if you have 0.4.0.
emm...我再查看一下 ps:0.2.7运行正常,可能是我的设备对多线程不太支持
Bug confirmed in 0.3.2. Won't release a fix as 0.4.0 works
ubuntu 16.04 python3,python2都试过了 好像停在了 compare.py:143 [x for x in map(do, programs)]这行 还请查看一下是我的问题还是新版对拍器的问题