我正在使用Eclipse Mars 2,Pydev 5.1.2,Python 3.5。我写了一个简单的代码来获取要传递的列表数(变量num
),并将每个后续输入打印为整数列表:
num=int(input()) #taking the no of lists to be inputted
n=[] #stores the elements in each list
for i in range(0,num): #iterating over the test cases
n = [int(x) for x in input().split()]
print("n: ",n)
我在for
循环上放了一个断点。当我调试程序时,在输入"列表数"后,当我输入列表的实际元素,然后按"输入"时,我收到语法错误,如下所示:
程序执行正常。我只在调试时收到此错误。
请帮助我了解原因。
:迈克尔要求的控制台输出:
pydev debugger: starting (pid: 4172)
2
2 1
Traceback (most recent call last):
File "E:\software\dev tools\eclipse\eclipse-jee-neon-2-win32\dropins\plugins\org.python.pydev_5.5.0.201701191708\pysrc\_pydevd_bundle\pydevd_vars.py", line 354, in evaluate_expression
compiled = compile(expression, '<string>', 'eval')
File "<string>", line 1
2 1
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\software\dev tools\eclipse\eclipse-jee-neon-2-win32\dropins\plugins\org.python.pydev_5.5.0.201701191708\pysrc\_pydevd_bundle\pydevd_comm.py", line 1122, in do_it
result = pydevd_vars.evaluate_expression(self.thread_id, self.frame_id, self.expression, self.doExec)
File "E:\software\dev tools\eclipse\eclipse-jee-neon-2-win32\dropins\plugins\org.python.pydev_5.5.0.201701191708\pysrc\_pydevd_bundle\pydevd_vars.py", line 356, in evaluate_expression
Exec(expression, updated_globals, frame.f_locals)
File "E:\software\dev tools\eclipse\eclipse-jee-neon-2-win32\dropins\plugins\org.python.pydev_5.5.0.201701191708\pysrc\_pydevd_bundle\pydevd_exec2.py", line 3, in Exec
exec(exp, global_vars, local_vars)
File "<string>", line 1
2 1
^
SyntaxError: invalid syntax
答案 0 :(得分:0)
请升级到最新版本。
这已在5.4.0中修复。
从发行说明(摘自http://www.pydev.org/history_pydev.html):
调试器:当用户等待某些输入时,它将不再尝试评估输入的内容。