Python Pydev调试器在提供输入后引发语法错误
我正在使用EclipseMars2、Pydev5.1.2和Python3.5。我编写了一个简单的代码来获取要传递的列表数量(变量Python Pydev调试器在提供输入后引发语法错误,python,eclipse,debugging,syntax-error,pydev,Python,Eclipse,Debugging,Syntax Error,Pydev,我正在使用EclipseMars2、Pydev5.1.2和Python3.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 c
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)
我在循环中设置了一个断点。当我调试程序时,在输入“列表数量”后,当我输入列表的实际元素并按“enter”键时,我得到一个语法错误,如下所示:
程序运行良好。我只有在调试时才收到此错误
请帮我了解这件事的原因
:根据Michael的要求,控制台输出:
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
pydev调试器:正在启动(pid:4172)
2.
2 1
回溯(最近一次呼叫最后一次):
文件“E:\software\dev tools\eclipse\eclipse-jee-neon-2-win32\dropins\plugins\org.python.pydev_5.5.0.201701191708\pysrc\\u pydevd_bundle\pydevd_vars.py”,第354行,在evaluate_表达式中
compiled=compile(表达式“”,“eval”)
文件“”,第1行
2 1
^
SyntaxError:无效语法
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“E:\software\dev tools\eclipse\eclipse-jee-neon-2-win32\dropins\plugins\org.python.pydev_5.5.0.201701191708\pysrc\u pydevd_bundle\pydevd_comm.py”,第1122行
结果=pydevd_vars.evaluate_表达式(self.thread_id、self.frame_id、self.expression、self.doExec)
文件“E:\software\dev tools\eclipse\eclipse-jee-neon-2-win32\dropins\plugins\org.python.pydev_5.5.0.201701191708\pysrc\u pydevd_bundle\pydevd_vars.py”,第356行,在evaluate\u表达式中
Exec(表达式、更新的\u全局、frame.f\u局部)
文件“E:\software\dev tools\eclipse\eclipse-jee-neon-2-win32\dropins\plugins\org.python.pydev_5.5.0.201701191708\pysrc\\u pydevd_bundle\pydevd_exec2.py”,Exec第3行
执行官(exp、全局变量、本地变量)
文件“”,第1行
2 1
^
SyntaxError:无效语法
请升级至最新版本
这是在5.4.0中修复的
从发行说明(摘自):
调试器:当用户等待某些输入时,它将不再尝试评估输入的内容。我更新了Eclipse Neon 2(4.6.2)、Pydev 5.5.0、Python 3.6。但是我仍然面临同样的问题。你能将第一个错误粘贴到文本中以便更容易看到。我仍然无法理解这个错误的原因。有人能提供这方面的线索吗?现在已经快两个月了。。。。