PUDB错误:<没有可用的源代码>

2024-06-17 11:48:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我是新来的。大多数情况下,它运行良好,但当我试图进入一个库时,它显然无法识别,我得到以下消息:

  <no source code available>                                                                                                                                                                                                                                                                                           
  If this is generated code and you would like the source code to show up here,
  add it to linecache.cache, like

  import linecache
  linecache.cache[filename] = (size, mtime, lines, fullname)

  You can also set the attribute _MODULE_SOURCE_CODE in the module in which this function
  was compiled to a string containing the code.

我尝试导入'linecache',而'cache'属性是一个字典。我尝试为丢失的模块创建一个条目几次,但没有成功。在

有人能给我一个简单和/或实用的方法来添加一个无法识别的模块到pudb的例子吗?在


Tags: 模块thetonoin消息cachesource
1条回答
网友
1楼 · 发布于 2024-06-17 11:48:26

我的工作方式如下。在

当执行一段动态生成的代码时,我收到了这个消息。我追踪到代码生成的位置,并补充道:

import linecache
linecache.cache[__file__] = (len(source), 0, source, __file__)

{source对应于变量

之后我观察到,在pudb交互模式下,堆栈列表中出现了一个新项。这个新项目在抛出<no source code available>消息的项目之前。在

当我在这个新项目上导航时,我可以看到生成的源代码。在

相关问题 更多 >