def get_processes(): processes = [] try: for proc in psutil.process_iter(): if proc.name() == 'pulseaudio': proc.__class__ = PulseAudioProcess if not hasattr(proc, 'application'): proc.application = None if not hasattr(proc, 'disabled'): proc.disabled = False processes.append(proc) except psutil.NoSuchProcess: pass return processes