python cProfile 和配置文件模型跳过函数

发布于 2024-08-09 18:59:57 字数 813 浏览 3 评论 0原文

基本上,当我运行 cProfile 模块时,它会跳过一些函数,而正常的配置文件模块会产生此错误。

    The debugged program raised the exception unhandled AssertionError
"('Bad call', ('objects/controller/StageController.py', 9, '__init__'), <frame object at 0x9bbc104>, <frame object at 0x9bb438c>, <frame object at 0x9bd0554>, <frame object at 0x9bcf2f4>)"
File: /usr/lib/python2.6/profile.py, Line: 301

我完成了所有搜索,但找不到任何东西。我怎样才能让它们正常工作?

@yk4ever

StageController.py 类是这样开始的:

class StageControl(ObjectControl):

    def __init__(self, canvas_name):
        ObjectControl.__init__(self, canvas_name,"stage_object")
        self.model = StageModel()
        self.variables()
        self.make_stage()
        self.overrides()

上面的“Bad call”错误似乎不喜欢这个类

basically the cProfile module skips some functions when i run it, and the normal profile module produces this error.

    The debugged program raised the exception unhandled AssertionError
"('Bad call', ('objects/controller/StageController.py', 9, '__init__'), <frame object at 0x9bbc104>, <frame object at 0x9bb438c>, <frame object at 0x9bd0554>, <frame object at 0x9bcf2f4>)"
File: /usr/lib/python2.6/profile.py, Line: 301

ive done all the searches and i cant find anything. How do i make them work properly?

@ yk4ever

StageController.py class starts like this:

class StageControl(ObjectControl):

    def __init__(self, canvas_name):
        ObjectControl.__init__(self, canvas_name,"stage_object")
        self.model = StageModel()
        self.variables()
        self.make_stage()
        self.overrides()

the "Bad call" error above seems to dislike this class

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝梦月影 2024-08-16 18:59:57

我已经找到问题了。 Psyco
我的“StageControl”继承的“ObjectControl”类有一个简单的:

import psyco
psyco.full()

在类内部,这导致了错误,因此只有继承“ObjectControl”的类中的方法导致探查器失败。我在某处读到,仅在必要时导入 psyco 是个好主意,事实证明这是一个坏主意。

我曾经使用过 psyco 一段时间,直到遇到 cython,但由于某种原因留下了 psyco 导入声明足够长的时间让分析器感到厌烦。我自从抛弃了psyco。

这个故事的寓意是:只要坚持使用 cython,最终没有什么比 C 更好的了。

I've found the problem. Psyco
the 'ObjectControl' class which my 'StageControl' inherited has a simple:

import psyco
psyco.full()

INSIDE the class, which caused the error hence only the methods in the classes which inherited 'ObjectControl', caused the profiler to fail. i read somewhere it was a good idea to import psyco only where it was necessary, turns out thats a bad idea.

I had used psyco for a time until i came across cython, but for some reason left the psyco import statements lying around long enough to bork the profiler. ive since dumped psyco.

the moral of the story is: just stick with cython, at the end of the day nothing beats C.

我不是你的备胎 2024-08-16 18:59:57

Python Bug #1117670 似乎描述了同样的问题。那里还附有一​​个用于重现类似问题的最小测试脚本。该错误已被标记为已修复。

请参阅上述 Python Bug 报告中的 msg24185了解可在 Python 2.4 上使用的解决方法

您使用哪个Python版本?

Python Bug #1117670 seems to describe the same issue. A minimal test script to reproduce that similar problem also attached there. The bug has been marked as fixed.

See msg24185 in the above Python Bug report for a workaround which can be used on Python 2.4.

Which Python version do you use?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文