profile.run won't run!

Nick Perkins nperkins7 at home.com
Thu Jun 14 22:31:16 EDT 2001


I can't get profile.run to work..

def solve_problem():
    ...blahblahblah

solve_problem()          # works
exec("solve_problem()")  # also works

but..

profile.run("solve_problem()")

...
  File "c:\python21\lib\profile.py", line 356, in run
    return self.runctx(cmd, dict, dict)
  File "c:\python21\lib\profile.py", line 362, in runctx
    exec cmd in globals, locals
  File "<string>", line 1, in ?
NameError: name 'solve_problem' is not defined


I have verified that "solve_problem" is in globals() when I am doing this.
In another IDE I get an Unbound Local error in the first function that comes
up.

Am I missing something?






More information about the Python-list mailing list