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 the

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 >(, instance at >0xb7d6738c>, ) > >Something like this? I think the Gary means

[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 (wher

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() ... ra