Re: Step-by-step exec

2008-11-07 Thread M.-A. Lemburg
On 2008-11-07 11:48, [EMAIL PROTECTED] wrote: > On Nov 7, 11:20 am, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: > >>> What I am trying to do is to execute it "step-by-step", so that I can >>> capture the exception if one line (or multi-line statement) fails, print >>> a warning

Re: Step-by-step exec

2008-11-07 Thread gregory . lielens
On Nov 7, 11:20 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > > What I am trying to do is to execute it "step-by-step", so that I can > > capture the exception if one line (or multi-line statement) fails, print > > a warning about the failure, and continue the execution fo th

Re: Step-by-step exec

2008-11-07 Thread gregory . lielens
On Nov 6, 9:53 pm, Aaron Brady <[EMAIL PROTECTED]> wrote: > Check out the InteractiveConsole and InteractiveInterpreter classes. > Derive a subclass and override the 'push' method.  It's not documented > so you'll have to examine the source to find out exactly when and what > to override. Thanks,

Re: Step-by-step exec

2008-11-07 Thread Steven D'Aprano
On Thu, 06 Nov 2008 03:27:53 -0800, gregory.lielens wrote: > Hi, > > I am using a small python file as an input file (defining constants, > parameters, input data, ...) for a python application. The input file is > simply read by an exec statement in a specific dictionary, and then the > applicat

Re: Step-by-step exec

2008-11-06 Thread Aaron Brady
trol over the input file generation ? If the input file > > can be easily divided into self sufficient blocks of code, you could > > read each block in one at a time and do a compile() and exec(). Your > > input file need not be a full python script too, you could just have >

Re: Step-by-step exec

2008-11-06 Thread gregory . lielens
do a compile() and exec(). Your > input file need not be a full python script too, you could just have > token delimited blocks of python code which are read in 1 block at a > time and then exec(). > > -srp > > > > > Is there a better way for a step-by-step exec? Synta

Re: Step-by-step exec

2008-11-06 Thread [EMAIL PROTECTED]
ficient blocks of code, you could read each block in one at a time and do a compile() and exec(). Your input file need not be a full python script too, you could just have token delimited blocks of python code which are read in 1 block at a time and then exec(). -srp > > Is there a better w

Step-by-step exec

2008-11-06 Thread gregory . lielens
flow like if - else statements or loops. Is there a better way for a step-by-step exec? Syntax errors in the input script are not really a problem (as it is generated elsewhere, it is not directly edited by users), although it would be nice to catch. The biggest problem are runtime errors (attribut