我在让我的项目在支持命令调用(通过向上箭头)和命令编辑的控制台中的断点处停止时遇到问题。显然我是Eclipse和PyDev的新手。配置建议赞赏!!
这是一个在本地运行的简单Python项目。当我遇到断点时,出现的控制台不支持命令调用(通过向上箭头)或命令编辑。当我向上箭头时,光标逐行向前移动。当我向上箭头指向包含上一个命令的行并点击编辑键(例如DEL)时,光标会立即跳转到窗口的底部(并且不会带有其余的命令)。此控制台也不显示python命令提示符'>>>'
pydev debugger: starting (pid: 29008)
mainIndex ## I type
251
n ## I type
1
当我加载相同的项目并运行交互式PyDev控制台时,我确实得到了Python提示符和所需的命令调用和编辑,但是当我执行模块(例如,点击断点)时,运行文件(.. 。)命令不返回控件。我在Preferences / PyDev / Interactive Console中启用了“将控制台连接到调试会话”选项。
PyDev Interactive Console
>>> import sys; import os; os.chdir("/home/bobhy/Dropbox/MOOC/HRA/emailMatch"); print('{} {}, cwd={}'.format((sys.executable or sys.platform), sys.version, os.getcwd()))
/usr/bin/python3 3.3.2+ (default, Feb 28 2014, 00:52:16)
[GCC 4.8.1], cwd=/home/bobhy/Dropbox/MOOC/HRA/emailMatch
PyDev console: using default backend (IPython not available).
>>> print ("{}...".format(n))
Traceback (most recent call last):
File "/usr/lib/python3.3/code.py", line 90, in runcode
exec(code, self.locals)
File "<console>", line 1, in <module>
NameError: name 'n' is not defined
>>> runfile('fuzzyMatch.py')
0...
## wishing for prompt here, but runfile doesn't return control
最后,如果我运行项目并让它达到断点,就像在第一个场景中一样,右键单击Debug窗口中的项目范围,然后从上下文菜单中选择PyDev / Debug Console,我得到的显然是第三种控制台风味:
PyDev Debug Console [1]
>>> import sys; import os; os.chdir("${container_loc}"); print('{} {}, cwd={}'.format((sys.executable or sys.platform), sys.version, os.getcwd()))
[Current context]: File "/home/bobhy/Dropbox/MOOC/HRA/emailMatch/fuzzyMatch.py", line 53, in main
Traceback (most recent call last):
File "/home/bobhy/devtools/eclipse-kepler-SR2-linux-X86_64/plugins/org.python.pydev_3.4.1.201403181715/pysrc/pydevd_console.py", line 138, in runcode
Exec(code, self.frame.f_globals, self.frame.f_locals)
File "/home/bobhy/devtools/eclipse-kepler-SR2-linux-X86_64/plugins/org.python.pydev_3.4.1.201403181715/pysrc/pydevd_exec2.py", line 3, in Exec
exec(exp, global_vars, local_vars)
File "<console>", line 1, in <module>
FileNotFoundError
:
[Errno 2] No such file or directory: '${container_loc}'
>>> a = 'abc' ## this variable does show up in the Variables window
但是这个一直隐藏在调试控制台后面,我无法使用它。
使用Python 3.3,Pydev 3.4.1,Eclipse-Kepler Service Release 2,Linux Mint Petra 16