-1

I'm new to python and I'm trying to recreating in a python dictionary the processes hierarchy like the unix pstree does.

Unfortunately I cannot use the wonderful psutil library cause I don't have permissions to search into /proc path.

Did somebody already done this exercise ?

chew23
  • 1

1 Answers1

1

If you want to run pstree you can use subprocess:

from subprocess import check_output


out = check_output(["pstree","-u","foo"])
print(out)
Padraic Cunningham
  • 176,452
  • 29
  • 245
  • 321
  • I cannot use pstree since I need all system processes informations and I have only sudo permissions for "ps" command as root. – chew23 Mar 02 '15 at 15:02