I suggested: > And suppose instead of '<string>' I'd like to give the value or the > leading prefix of the value instead of the unhelpful word '<string>'? > How would one do that? Again, one way is to go into the outer frame > get the source line (if that exists), parse that and interpolate > argument to exec(file). Is there are better way?
I've hacked this approach into the CVS for pydb, but it is not all that accurate (although in practice I'm pleased with the result). My current regular expression is (^|\s+)exec\s+(.*) which does match simple things, but it would fail on say by *not* matching: x=1;exec "y=2";exec "z=3" and fail by *wrongly* matching on: x=" exec meeting in 5 mins" Even if I knew how to call the python parser on the line, that still might not be good enough in the presence of continuation lines. This probably should be addressed at a lower level in gathering traceback data inside Python. > Another and perhaps more direct way to distinguish exec/execfile might ^^^^^^^^ execfile is not a problem, just exec. -- http://mail.python.org/mailman/listinfo/python-list