Skip to content Skip to sidebar Skip to footer

Streaming Pipes In Python

I'm trying to convert the output of vmstat into a CSV file using Python, so I use something like this to convert to CSV and add the date and time as coloumns: vmstat 5 | python mys

Solution 1:

VMstat 5,does not close the stdout, so the python buffer is still waiting for more data.

Use this instead:

for line in iter(sys.stdin.readline, ""):
    print line

Post a Comment for "Streaming Pipes In Python"