Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
Read all processes identifiers. The function is a generator,
use it with: ::

   for pid in readProcesses(): ...

        def readProcesses():
    """
    Read all processes identifiers. The function is a generator,
    use it with: ::

       for pid in readProcesses(): ...
    """
    for filename in listdir('/proc'):
        try:
            yield int(filename)
        except ValueError:
            # Filename is not an integer (eg. "stat" from /proc/stat)
            continue
        


src/n/e/Netzob-0.4.1/src/netzob_plugins/Capturers/IpcCapturer/IpcCapturer/IpcCapturer.py   Netzob(Download)
import os
import time
from ptrace.linux_proc import readProcesses, readProcessCmdline
import subprocess
from gi.repository import GObject
        processList = []
        uidUser = self.getUidOfCurrentUser()
        for pid in readProcesses():
            if (uidUser == "0") or (uidUser == self.getUidOfProcess(pid)):
                processList.append(str(pid) + "\t" + str(readProcessCmdline(pid)[0]))

src/n/e/netzob-HEAD/src/netzob_plugins/Capturers/IpcCapturer/IpcCapturer/IpcCapturer.py   netzob(Download)
import os
import time
from ptrace.linux_proc import readProcesses, readProcessCmdline
import subprocess
from gi.repository import GObject
        processList = []
        uidUser = self.getUidOfCurrentUser()
        for pid in readProcesses():
            if (uidUser == "0") or (uidUser == self.getUidOfProcess(pid)):
                processList.append(str(pid) + "\t" + str(readProcessCmdline(pid)[0]))