调试器在 pycharm 中不起作用

Posted

技术标签:

【中文标题】调试器在 pycharm 中不起作用【英文标题】:Debugger not functioning in pycharm 【发布时间】:2021-08-28 05:50:22 【问题描述】:

enter image description here我正在尝试调试我拥有的这个 py 文件,但控制台抛出了这个

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_process_net_command.py", line 891, in process_net_command
    py_db.writer.add_command(cmd)
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 355, in add_command
    self.cmdQueue.put(cmd)
AttributeError: 'Queue' object has no attribute 'put'
Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_process_net_command.py", line 891, in process_net_command
    py_db.writer.add_command(cmd)
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 355, in add_command
    self.cmdQueue.put(cmd)
AttributeError: 'Queue' object has no attribute 'put'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 318, in _on_run
    self.process_command(cmd_id, int(args[1]), args[2])
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 333, in process_command
    self.process_net_command(self.global_debugger_holder.global_dbg, cmd_id, seq, text)
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_process_net_command.py", line 909, in process_net_command
    py_db.writer.add_command(cmd)
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 355, in add_command
    self.cmdQueue.put(cmd)
AttributeError: 'Queue' object has no attribute 'put'
Can't process net command: 501  1   0.1 UNIX

谁能解释一下这是什么意思?

它还说“@NotNull 参数 's' 与 python 调试器的连接失败”

【问题讨论】:

【参考方案1】:

AttributeError: 'Queue' object has no attribute 'put'

这是错误信息。但我不确定是什么原因造成的,因为这可能是由各种问题引起的。

也许检查你的项目中是否有与queue.py的内置文件相同的文件名?如果是这样,您应该可以通过将文件名更改为 myQueue.py 之类的名称来修复它

您还可以提供代码的更多详细信息以定位错误。

【讨论】:

以上是关于调试器在 pycharm 中不起作用的主要内容,如果未能解决你的问题,请参考以下文章

Django 断点不起作用 PyCharm

断点在 Qt Creator 中不起作用

某些功能在“发布”部署中不起作用(但在“调试”中起作用)

Xcode 12 beta 1:po 在调试器中不起作用

调试模式在 Visual Studio 2015 中不起作用

我的自动完成功能在 codeigniter 中不起作用