在Python中保存痕量功能的结果
我正在尝试使用Python使用以下代码提供的“跟踪”功能来找出一些记录信息。
tracer = trace.Trace(
ignoredirs=[sys.prefix, sys.exec_prefix],
trace=False,
countfuncs = True,
count=False,
timing = True)
tracer.run('exec(script, variables, variables)')
# make a report, placing output in the current directory
r = tracer.results()
r.write_results(show_missing=True,coverdir='trace_vizier')
跟踪结果在终端中打印出来,但是未生成保存数据的文件。
有人可以告诉我为什么会发生这种情况吗?
注意 - https://docs.python.org/3/library/library/trace.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来它与将内置的函数放置为从跟踪中运行方法的命令有关,并且与参数
countfuncs
andcount
count 接收到。这是我所做的:
从参数中,跟踪构造器接收
countfuncs
和count
tocountfuncs = false,count = true
。下一个将exec(脚本,变量,变量)'在您自己的函数内部,然后将其传递到运行方法中。
一个例子:
It appears that It has something to do with putting in-builts functions as command for the run method from Trace, and with the arguments
countfuncs
andcount
that the Trace constructor receives.Here is what I did:
From the arguments the Trace constructor receives change
countfuncs
andcount
tocountfuncs = False, count=True
.Next put exec(script, variables, variables)' inside a function of your own and pass it into the run method.
An example: