On 10 Aug 2005 15:08:21 -0700, "Leo" <[EMAIL PROTECTED]> wrote:
>Good try, but that doesn't seem to work either. Maybe I should have >emphasized that what I really want is the line of code, as opposed to >the entire frame. Here is the output of sys._getframe() on my system: > >Python 2.3.4 (#1, Feb 2 2005, 12:11:53) >[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2 >Type "help", "copyright", "credits" or "license" for more information. >>>> import sys >>>> sys._getframe() ><frame object at 0x9fbce0c> >>>> from inspect import * >>>> getframeinfo(sys._getframe()) >('<stdin>', 1, '?', None, None) > >Is it different in 2.4? Maybe there is something else in sys.* that I >am having trouble finding? > Isn't there some requirement of having a source file in order to get the line of code, which an interactive session does not satisfy? (Maybe a strategically located StringIO instance encapsulating the latest interactive chunk as "source file" could solve it?) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list