How can I set real time priority with psutil. When I try this: process.nice(psutil.REALTIME_PRIORITY_CLASS)
REALTIME_PRIORITY_CLASS
results in HIGH_PRIORITY_CLASS
.
Asked
Active
Viewed 1,665 times
2

Martijn Pieters
- 1,048,767
- 296
- 4,058
- 3,343

Jakub Bláha
- 1,491
- 5
- 22
- 43
-
Which OS, `psutil` Version. May I see `print(psutil.REALTIME_PRIORITY_CLASS)`. – stovfl May 18 '17 at 15:39
-
1Windows. Maybe I need to run it as admin. `>>> import psutil >>> print(psutil.REALTIME_PRIORITY_CLASS) 256` – Jakub Bláha May 18 '17 at 17:15
-
Please edit your Question to clarify: _**it sets priority to high but not real time**_. Does **high** working and only **realtime** NOT? Or does it mean `REALTIME_PRIORITY_CLASS` results in `HIGH_PRIORITY_CLASS`. – stovfl May 18 '17 at 17:19
1 Answers
1
I had exactly the same problem, running python with "as Administrator" solved the issue (On Win10 with python3.7).
Create a windows shortcut to "python " and set "Run as administrator" in the Advanced settings of the shortcut.

Andre
- 26
- 2
-
In addition to setting "Run as administrator" for the python, if you are running the python within a command-line interpreter (e.g., cmd.exe, or Cmder.exe in Windows), you need to set "Run as administrator" for the command-line interpreter itself. – ashkan Apr 22 '22 at 02:50