First page Back Continue Last page Overview Graphics

Adopt output in Python

Following call returns only in stdout:

>>> process = subprocess.Popen(['ls','-l'])

>>> total 132

-rw-r--r-- 1 bernd bernd 0 2010-10-06 10:03 abc

-rw-r--r-- 1 bernd bernd 0 2010-10-06 10:04 abcd

-rw-r--r-- 1 bernd bernd 660 2010-09-30 21:34 curses.py

this way you can handle the output in Python:

>>> process = subprocess.Popen(['ls','-l'], stdout=subprocess.PIPE)

>>> print process.stdout.read()

total 132

-rw-r--r-- 1 bernd bernd 0 2010-10-06 10:03 abc

-rw-r--r-- 1 bernd bernd 0 2010-10-06 10:04 abcd

-rw-r--r-- 1 bernd bernd 660 2010-09-30 21:34 curses.py