Python profiler usage with objects
rik
rbelew at ucsd.edu
Wed Jun 30 01:52:05 EDT 2010
harit <harit.himanshu <at> gmail.com> writes:
>
> Hi,
>
> I have a specific question regarding the usage of profiler. I am new
> to python programming I am trying to profile a function which I want
> to invoke as a class method, something like this
>
> import profile
>
> class Class:
>
> def doSomething():
>
> do here ..
>
> def callMethod():
>
> **self.doSomething()**
> instead of this I want to use
>
> **profile.run(self.doSomething())**
> but the profile.run expects the string inside it and I get error
>
> TypeError: exec: arg 1 must be a string, file, or code object
>
> Can somebody please help?
>
> Thank you
>
Harit,
i am OLD to python, and have used its profiler in the past.
but i'm getting your same error:
> TypeError: exec: arg 1 must be a string, file, or code object
on both Ubuntu with Python 2.6 and OSX with 2.4. with both
cProfile and profile?! whether or not i specify a file for
profile output!?!
anybody else having trouble profiling?
- rik
More information about the Python-list
mailing list