Re: [Tutor] capturing exceptions from an exec statement

2008-04-08 Thread Andreas Kostyrka
Python 2.4.5 (#2, Mar 12 2008, 00:15:51) [GCC 4.2.3 (Debian 4.2.3-2)] on linux2 Type help, copyright, credits or license for more information. try: ... exec(raise ValueError) ... except: ... print raised some exception ... import sys ... print sys.exc_info() ... raised some

[Tutor] capturing exceptions from an exec statement

2008-04-08 Thread Garry Willgoose
I'm writing a (very simple) command line window for use within my Tkinter GUI menu driven program (Aside: I want to provide a Matlab like command line capability within an otherwise menu driven program ... but where the script language is Python). The guts of executing the command are

Re: [Tutor] capturing exceptions from an exec statement

2008-04-08 Thread Alan Gauld
Andreas Kostyrka [EMAIL PROTECTED] wrote try: ... exec(raise ValueError) ... except: ... print raised some exception ... import sys ... print sys.exc_info() ... raised some exception (class exceptions.ValueError at 0xb7d83b3c, exceptions.ValueError instance at 0xb7d6738c,

Re: [Tutor] capturing exceptions from an exec statement

2008-04-08 Thread Garry Willgoose
Andreas, Alan, Oops ... I'm embarassed to admit the problem seems to have gone away. I don't know maybe in my testing I fed it some valid python. But anyway I made sure to feed it something that was invalid it now works fine. Its been a long day Sorry to bother you. Alan thanks for