Re: Trapping the segfault of a subprocess.Popen

2011-04-07 Thread Pierre GM
On Apr 7, 5:12 am, Terry Reedy wrote: > On 4/6/2011 7:58 PM, Nobody wrote: > > > On Wed, 06 Apr 2011 02:20:22 -0700, Pierre GM wrote: > > >> I need to run a third-party binary from a python script and retrieve > >> its output (and its error messages). I u

Re: Trapping the segfault of a subprocess.Popen

2011-04-07 Thread Pierre GM
On Apr 7, 1:58 am, Nobody wrote: > On Wed, 06 Apr 2011 02:20:22 -0700, Pierre GM wrote: > > I need to run a third-party binary from a python script and retrieve > > its output (and its error messages). I use something like > >>>> process = subprocess.Popen(o

Trapping the segfault of a subprocess.Popen

2011-04-06 Thread Pierre GM
All, I need to run a third-party binary from a python script and retrieve its output (and its error messages). I use something like >>> process = subprocess.Popen(options, stdout=subprocess.PIPE, >>> stderr=subprocess.PIPE) >>> (info_out, info_err) = process.communicate() That works fine, except

Re: Logging exceptions to a file

2009-05-07 Thread Pierre GM
On May 7, 5:32 am, Lie Ryan wrote: > Pierre GM wrote: > > All, > > I need to log messages to both the console and a given file. I use the > > following code (on Python 2.5) > > >>>> import logging > >>>> # > >>>> logging.b

Logging exceptions to a file

2009-05-06 Thread Pierre GM
All, I need to log messages to both the console and a given file. I use the following code (on Python 2.5) >>> import logging >>> # >>> logging.basicConfig(level=logging.DEBUG,) >>> logfile = logging.FileHandler('log.log') >>> logfile.setLevel(level=logging.INFO) >>> logging.getLogger('').addHandl

Re: what is wrong with my python code?

2007-02-07 Thread Pierre GM
On Wednesday 07 February 2007 12:43:34 Dongsheng Ruan wrote: > I got feed back saying" list object is not callable". But I can't figure > out what is wrong with my code. > for i in range(l): > print A(i) You're calling A, when you want to access one of its elements: use the straight bracket