Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
154 views
in Technique[技术] by (71.8m points)

python - Tell that process is not in the background?

I'm writing a script that starts a process (UiPath.Executor.exe) unless it's already running:

 while True:
        process_names = (process_names.name() for process_names in psutil.process_iter()) # <- task mngr processes
        if "UiPath.Executor.exe" not in process_names: #then run it

The problem is I'm on a server with multiple users who might be running the same process at the same time, and the process shows up in the Background processes of the Task Manager. So the script thinks it's already running.

When my version of it runs, it runs in Apps section of the task manager, not Background processes. enter image description here

Is there a way to differentiate between Apps and Background processes in my script?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...