regular expression problem

2007-04-30 Thread John Davis

Hi all,
I have a large logged string "str". I would like to strip down "str" so that
it contains only the lines that have "ERROR" in them. Could somebody give me
and indication of how to do this?

Thx
John.
=
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Any "consumer review generators" available?

2007-03-29 Thread John Davis

Hi all,
I am using Python 2.4. I am trying to run a C++ program on Red hat linux
enterprise edition from Python by using various methods like > Os.system


Os.popen

Subprocess.popen

Os.execvp

Os.spawnl



In all of these methods the program kills python program also. So, let's say
i am in python shell as follows

$> python
Python 2.4.4 (#1, Mar 28 2007, 15:30:40)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import os
os.system('program_name')

...
...
#program_output
...
...
No more foreground apps, exiting
Signal received. Terminating
Signal received. Terminating
...
...
Hangup
..
..
$>

That is I exit the python shell as well. Please notice that Hangup written
in between which is not a part of the program output (i.e. I don't get this
'Hangup'  when I run the program independently from the command prompt). The
other things are part of the program output on stdout & stderr. Can anybody
give some pointers on how to solve this. I am running out of ideas on how to
run this program without exiting the python shell.


Thx
John.
-- 
http://mail.python.org/mailman/listinfo/python-list

python problem: creating subprocess (it kills the parent process)

2007-03-29 Thread John Davis

Hi all,
I am using Python 2.4. I am trying to run a C++ program on Red hat linux
enterprise edition from Python by using various methods like > Os.system


Os.popen

Subprocess.popen

Os.execvp

Os.spawnl



In all of these methods the program kills python program also. So, let's say
i am in python shell as follows

$> python
Python 2.4.4 (#1, Mar 28 2007, 15:30:40)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import os
os.system('program_name')

...
...
#program_output
...
...
No more foreground apps, exiting
Signal received. Terminating
Signal received. Terminating
...
...
Hangup
..
..
$>

That is I exit the python shell as well. Please notice that Hangup written
in between which is not a part of the program output (i.e. I don't get this
'Hangup'  when I run the program independently from the command prompt). The
other things are part of the program output on stdout & stderr. Can anybody
give some pointers on how to solve this. I am running out of ideas on how to
run this program without exiting the python shell.


Thx
John.
-- 
http://mail.python.org/mailman/listinfo/python-list