views:

178

answers:

2

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

A: 

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?

fviktor
thanks for the help, but ive found the problem.......psyco
spearfire
It is not a good idea to do any profiling or debugging while Psyco is enabled, indeed.
fviktor
+1  A: 

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.

spearfire