J
Jean-Michel Pichavant
Hi python fellows,
I'm currently inspecting my Linux process list, trying to parse it in
order to get one particular process (and kill it).
I ran into an annoying issue:
The stdout display is somehow truncated (maybe a terminal length issue,
I don't know), breaking my parsing.
import subprocess
commandLine = ['ps', '-eo "%p %U %P %y %t %C %c %a"']
process = subprocess.Popen(commandLine, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
processList, stderrdata = process.communicate()
Here is a sample of what I get in processList.split('\n'):
' "25487 1122 4344 ? 7-17:48:32 2.5 firefox-bin
/usr/lib/iceweasel/firefox-"',
' "25492 1122 4892 pts/6 00:08 57.2 ipython
/usr/bin/python /usr/bin/ip"',
As you can see, to complete process command line is truncated.
Any clue on how to get the full version ?
JM
(python 2.5)
I'm currently inspecting my Linux process list, trying to parse it in
order to get one particular process (and kill it).
I ran into an annoying issue:
The stdout display is somehow truncated (maybe a terminal length issue,
I don't know), breaking my parsing.
import subprocess
commandLine = ['ps', '-eo "%p %U %P %y %t %C %c %a"']
process = subprocess.Popen(commandLine, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
processList, stderrdata = process.communicate()
Here is a sample of what I get in processList.split('\n'):
' "25487 1122 4344 ? 7-17:48:32 2.5 firefox-bin
/usr/lib/iceweasel/firefox-"',
' "25492 1122 4892 pts/6 00:08 57.2 ipython
/usr/bin/python /usr/bin/ip"',
As you can see, to complete process command line is truncated.
Any clue on how to get the full version ?
JM
(python 2.5)