【问题标题】:scons on win32: debugging SConstruct with pdbwin32 上的 scons:使用 pdb 调试 SConstruct
【发布时间】:2013-07-30 21:23:46
【问题描述】:

我正在尝试调试一个 SConstruct 文件,该文件在某个晦涩的函数深处失败了,我想单步调试代码。这是我尝试做的,但失败了:

$ python -m pdb `which scons.py`
> c:\python27\scripts\scons.py(26)<module>()
-> __revision__ = "src/script/scons.py 5357 2011/09/09 21:31:03 bdeegan"
(Pdb) b SConstruct:10
***  'SConstruct' not found from sys.path
(Pdb) import sys, os
(Pdb) sys.path.append(os.getcwd())
(Pdb) b SConstruct:10
***  'SConstruct' not found from sys.path
(Pdb)

如果我将 SConstruct 重命名为 SConstruct.py,它会成功设置断点,但它当然不起作用,因为“scons”加载的是 SConstruct,而不是 SConstruct.py。 有什么方法可以强制python在那里放一个断点?

我从 Win7 系统上的 msys bash 控制台运行它。 Python版本:

$ python
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

【问题讨论】:

    标签: python windows scons pdb


    【解决方案1】:

    Debugging SCons wiki page 上有一些提示。具体来说:

    scons --debug=pdb <args...>
    # from the wiki example: you can set a breakpoint on a file relative to sys.path
    (Pdb) b SCons/Tool/msvc.py:158 
    # you can set a breakpoint in the SConstruct file with the full path
    (Pdb) b /Users/me/code/project/SConstruct:10
    

    【讨论】:

    • 抱歉延迟响应,我想我找到了一些解决方法并称之为一天。反正我只是在windows下试了一下这个建议,好像行得通,谢谢!
    • 不幸的是,由于某种原因,它不适用于我的 ubuntu 设置,但也许我做错了什么......无论如何,问题主要是关于 Windows。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-20
    • 2018-10-20
    • 1970-01-01
    • 2010-11-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多