(level, pid=None)
Set the priority/nice of the application.
Set the priority/nice of the application.
Set the priority / nice of the application .
def set_priority(level, pid=None):
    """Set the priority/nice of the application."""
    process = psutil.Process(pid)
    try:
        level = level.lower().replace(' ', '')
        
        if level == 'realtime':
            process.nice(-20)
        elif level == 'high':
            process.nice(-13)
        elif level == 'abovenormal':
            process.nice(-7)
        elif level == 'normal':
            process.nice(0)
        elif level == 'belownormal':
            process.nice(7)
        if level == 'low':
            process.nice(13)
            
    except AttributeError:
        process.nice(int(level))
def set_priority ( level , pid = None ) : process = psutil . Process ( pid ) try : level = level . lower ( ) . replace ( ' ' , '' ) if level == 'realtime' : process . nice ( - 20 ) elif level == 'high' : process . nice ( - 13 ) elif level == 'abovenormal' : process . nice ( - 7 ) elif level == 'normal' : process . nice ( 0 ) elif level == 'belownormal' : process . nice ( 7 ) if level == 'low' : process . nice ( 13 ) except AttributeError : process . nice ( int ( level ) )