- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
最近,我注意到我无法打开 pudb3 中的任何模块。以前我经常使用这个系统。我不确定哪些更改破坏了我的 pudb 环境。如何解决这个问题?
$ python -V
Python 3.7.2
$ which python
/home/jef/anaconda3/bin/python
$ which pudb3
/home/jef/anaconda3/bin/pudb3
$ pudb3 my_program.py --x y
m
打开模块。Traceback (most recent call last):
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/__init__.py", line 119, in runscript
dbg._runscript(mainpyfile)
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/debugger.py", line 457, in _runscript
self.run(statement, globals=globals_, locals=locals_)
File "/home/jef/anaconda3/lib/python3.7/bdb.py", line 585, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "eval.py", line 1, in <module>
"""An evaluation tool for various semantic analytis desigining services"""
File "eval.py", line 1, in <module>
"""An evaluation tool for various semantic analytis desigining services"""
File "/home/jef/anaconda3/lib/python3.7/bdb.py", line 88, in trace_dispatch
return self.dispatch_line(frame)
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/debugger.py", line 187, in dispatch_line
self.user_line(frame)
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/debugger.py", line 408, in user_line
self.interaction(frame)
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/debugger.py", line 376, in interaction
show_exc_dialog=show_exc_dialog)
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/debugger.py", line 2118, in call_with_ui
return f(*args, **kwargs)
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/debugger.py", line 2362, in interaction
self.event_loop()
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/debugger.py", line 2328, in event_loop
toplevel.keypress(self.size, k)
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/ui_tools.py", line 106, in keypress
result = self._w.keypress(size, key)
File "/home/jef/anaconda3/lib/python3.7/site-packages/urwid/container.py", line 1131, in keypress
return self.body.keypress( (maxcol, remaining), key )
File "/home/jef/anaconda3/lib/python3.7/site-packages/urwid/container.py", line 2271, in keypress
key = w.keypress((mc,) + size[1:], key)
File "/home/jef/anaconda3/lib/python3.7/site-packages/urwid/container.py", line 1590, in keypress
key = self.focus.keypress(tsize, key)
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/ui_tools.py", line 111, in keypress
return handler(self, size, key)
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/debugger.py", line 1355, in pick_module
build_filtered_mod_list(filt_edit.get_edit_text()))
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/debugger.py", line 1319, in build_filtered_mod_list
for name, mod in list(sys.modules.items())
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/debugger.py", line 1320, in <genexpr>
if mod_exists(mod))
File "/home/jef/anaconda3/lib/python3.7/site-packages/pudb/debugger.py", line 1301, in mod_exists
base, ext = splitext(filename)
File "/home/jef/anaconda3/lib/python3.7/posixpath.py", line 122, in splitext
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
我通过删除 .zshrc 禁用了 zsh,并且不使用 tmux。然而,它仍然引发同样的错误。
最佳答案
正在申请this patch到 /usr/lib/python3.7/site-packages/pudb/debugger.py
解决了我的 Fedora 31 系统上的相同问题。将 pudb
升级到较新版本将具有相同的效果(2019.1
和 2019.2
都有此更改)。
该补丁很小,因此我将其包含在此处。
commit af3bdb6e7c81b036dbc71690109b81e30b3c1185
Author: Alex Fikl <alexfikl@gmail.com>
Date: Thu Aug 9 09:53:39 2018 -0500
debugger: skip namespace packages in module listing
diff --git a/pudb/debugger.py b/pudb/debugger.py
index 444eaa6..da66884 100644
--- a/pudb/debugger.py
+++ b/pudb/debugger.py
@@ -1297,6 +1297,8 @@ class DebuggerUI(FrameVarInfoKeeper):
def mod_exists(mod):
if not hasattr(mod, "__file__"):
return False
+ if mod.__file__ is None:
+ return False
filename = mod.__file__
base, ext = splitext(filename)
关于python - 当我尝试打开模块时 pudb3 引发 TypeError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55737826/
PuDB 允许使用“+/-/=”键垂直调整窗口大小。 如何水平调整大小,改变窗口的相对宽度? 最佳答案 来自 pudb 的帮助屏幕(可以使用 ? 键显示 Sidebar-related (active
如何在 pudb 中查看堆栈跟踪? (即相当于 pdb Python 调试器中的 w/where 命令) 引用文献: pudb on PyPI pudb source on github 最佳答案 没
我正在调试一个 python 脚本,我想监视一个变量并在其值发生变化时得到通知。 有没有办法在 pudb 中做到这一点? 最佳答案 您不能在值发生变化(据我所知)时简单地请求通知。 但是,您可以同时设
我在尝试通过 pudb debugger 调试一些单元测试时遇到了一些问题. 测试在 python 上运行良好,但我没有运气在 pudb 上运行它们。 我隔离了问题,得到以下示例代码: class M
我更喜欢使用 pudb 进行 python 调试。我正在构建在 docker 容器内运行的 python 应用程序。 有人知道如何在 docker 容器中使用 pudb 吗? 谢谢 最佳答案 您需要在
我们有可能吗 pudb Windows 上的 python 调试器?如果是,您如何安装和运行它? 当我尝试使用 ez_setup 安装它时, python ez_setup.py .\path\to\
我一直在使用 pudb 来调试 python 代码,它非常直接并进入终端。但我一点也不喜欢它的颜色。 如下图所示 我在文件夹里面找到 .local/lib/python3.8/site-package
我如何用 python 调试器检查复杂变量(列表、字典、对象)的值,我是 python 新手,我试过 pudb,看起来当变量类型是复杂类型时,调试器只显示变量的类型,而不是值(value)。 是否可以
我在 Linux 上,希望它能像 pdb、gdb 一样工作,即按 enter 重复最后一个命令。我知道调试器有一个 Variables 监 window 口。 最佳答案 Ctrl-n/p - 浏览命令
我正在尝试使用 pudb 调试 python 应用程序,一切都很好,除了它没有显示实例变量(我们使用self.xxx访问)。它只显示 1 个名为 self 的变量。而且是原始类类型。 即使我在调用st
有什么方法可以调整pudb中命令行/解释器窗口/ Pane 的大小,就像可以调整侧 Pane 的大小一样? 最佳答案 将焦点放在命令行/解释器 Pane 中(使用 Ctrl-x)。 使用右箭头键将焦点
之前我选择的测试库是 unittest。它与我最喜欢的调试器 - PuDB 一起工作。不是 Pdb!!! 要将 PuDB 与 unittest 结合使用,我将 import pudb;pudb.set
我正在尝试调试使用 tox 进行单元测试的 python 代码库。由于弄清楚,其中一个失败的测试被证明是困难的,我想使用 pudb 来单步执行代码。 一开始,人们会认为只是pip install pu
我正在尝试调试从 Robot 执行的 python 代码。如前所述here由 Bryan Oakley 编写,可以使用以下方法对其进行调试: 导入系统,PDB; pdb.Pdb(stdout=sys.
我正在尝试在 Linux 上远程调试一个大型 C++ 项目,这在本地通过 Visual Studio 重新构建有点困难。因此我尝试通过控制台调试它。同时,gdb或 gdb --tui或 gdb-das
我是一名优秀的程序员,十分优秀!