Re: Getting better traceback info on exec and execfile - introspection?

2006-01-16 Thread R. Bernstein
Fernando Perez <[EMAIL PROTECTED]> writes: > So any regexp-matching based approach here is likely to be fairly brittle, > unless you restrict your tool to the standard python interpreter, and you > get some guarantee that it will always tag interactive code with > ''. Meant to mention for what it'

Re: Getting better traceback info on exec and execfile - introspection?

2006-01-15 Thread R. Bernstein
Fernando Perez <[EMAIL PROTECTED]> writes: > I thought a little about this. One possibility ... Thanks. A sibling thread has the code I'm currently using. > Oh, that's because you're using %run, so your code is in complete control. > What I meant about a restriction ... Okay. > If you are int

Re: Getting better traceback info on exec and execfile - introspection?

2006-01-15 Thread R. Bernstein
"Ziga Seilnacht" <[EMAIL PROTECTED]> writes: > You should check the getFrameInfo function in zope.interface package: > http://svn.zope.org/Zope3/trunk/src/zope/interface/advice.py?rev=25177&view=markup Thanks! Just looked at that. The logic in the relevant part (if I've extracted this correctly):

Re: Getting better traceback info on exec and execfile - introspection?

2006-01-15 Thread Ziga Seilnacht
R. Bernstein wrote: . . . > which is perhaps is a little more honest since one is not really in a > file called . However the way the debugger gets this *is* > still a little hoaky in that it looks for something in the frame's > f_code.co_filename *called* . And from that it *assumes* this > is an

Re: Getting better traceback info on exec and execfile - introspection?

2006-01-15 Thread Fernando Perez
R. Bernstein wrote: > Fernando Perez <[EMAIL PROTECTED]> writes: >> R. Bernstein wrote: > ... >> > However the frame information for exec or execfile looks like this: >> > File "", line 1, in ? >> >> That comes from how the code object was compiled: > ... >> So any regexp-matching based approac

Re: Getting better traceback info on exec and execfile - introspection?

2006-01-15 Thread R. Bernstein
Fernando Perez <[EMAIL PROTECTED]> writes: > R. Bernstein wrote: ... > > However the frame information for exec or execfile looks like this: > > File "", line 1, in ? > > That comes from how the code object was compiled: ... > So any regexp-matching based approach here is likely to be fairly bri

Re: Getting better traceback info on exec and execfile - introspection?

2006-01-14 Thread Fernando Perez
R. Bernstein wrote: > In doing the extension to the python debugger which I have here: > http://sourceforge.net/project/showfiles.php?group_id=61395&package_id=175827 > I came across one little thing that it would be nice to get done better. > > I notice on stack traces and tracebacks, an exec

Re: Getting better traceback info on exec and execfile - introspection?

2006-01-14 Thread R. Bernstein
I suggested: > And suppose instead of '' I'd like to give the value or the > leading prefix of the value instead of the unhelpful word ''? > 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

Getting better traceback info on exec and execfile - introspection?

2006-01-14 Thread R. Bernstein
In doing the extension to the python debugger which I have here: http://sourceforge.net/project/showfiles.php?group_id=61395&package_id=175827 I came across one little thing that it would be nice to get done better. I notice on stack traces and tracebacks, an exec or execfile command appears as