If I use
import os
os.nice(10)
The error is
AttributeError: 'module' object has no attribute 'nice'
nice
is probably only for Linux systems,
so how do I reduce the CPU resources available to my program?
It checks whether a particular process is running, and if it is not, then it executes it.
My code looks like this:
import subprocess, psutil
proc = subprocess.Popen(['flux'])
pid = proc.pid
while 1:
if not psutil.pid_exists(pid):
proc = subprocess.Popen(['flux'])
pid = proc.pid
I would like it to use the minimum possible resources.