如何在我的python脚本中检测它是否由调试解释器运行(即python_d.exe而不是python.exe)?我需要改变传递给扩展的一些dll的路径.
例如,我喜欢在我的python脚本开头做类似的事情:
#get paths to graphics dlls
if debug_build:
d3d9Path = "bin\\debug\\direct3d9.dll"
d3d10Path = "bin\\debug\\direct3d10.dll"
openGLPath = "bin\\debug\\openGL2.dll"
else:
d3d9Path = "bin\\direct3d9.dll"
d3d10Path = "bin\\direct3d10.dll"
openGLPath = "bin\\openGL2.dll"
Run Code Online (Sandbox Code Playgroud)
我想在扩展中添加一个"IsDebug()"方法,如果它是调试版本(即使用"#define DEBUG"构建),则返回true,否则返回false.但这似乎是一个黑客的东西我确定我可以让python告诉我...
jfs*_*jfs 14
Distutils用于sys.gettotalrefcount检测调试python构建:
# ...
if hasattr(sys, 'gettotalrefcount'):
plat_specifier += '-pydebug'
Run Code Online (Sandbox Code Playgroud)
*_d.exe'.它适用于任何名称._d.pyd'后缀.请参阅调试构建和Misc/SpecialBuilds.txt
| 归档时间: |
|
| 查看次数: |
2275 次 |
| 最近记录: |