Developing rpi-rgb-led based python code with thonny

Hello there,

I would like wrote some code to use my rgb led matrix.
My issue is when I run my code I got this error in thony, and white line appear on the led panel:
“Press CTRL-C to stop sample
Can’t set realtime thread priority=99: Operation not permitted.
You are probably not running as root ?
This will seriously mess with color stability and flicker
of the matrix. Please run as root (e.g. by invoking this
program with sudo), or setting the capability on this
binary by calling
sudo setcap ‘cap_sys_nice=eip’ /usr/bin/python3.7”

My code is the following:
#!/usr/bin/env python
from samplebase import SampleBase
from rgbmatrix import RGBMatrix, RGBMatrixOptions, graphics
import time

class Show(SampleBase):
    def __init__(self, *args, **kwargs):
        super(Show, self).__init__(*args, **kwargs)
    
    def run(self):
        ops = RGBMatrixOptions()
        ops.rows = 20
        ops.cols = 40
        ops.chain_length = 2
        ops.parallel = 2
        ops.multiplexing = 10
        ops.row_address_type = 4
        ops.drop_privileges = False #This line should help but it doesn't :(

        matrix = RGBMatrix(options = ops)
        #matrix.Clear()
        
        graphics.DrawLine(matrix, 0, 40, 0, 39, graphics.Color(255,0,0))
        time.sleep(2)


# Main function
if __name__ == "__main__":
    show = Show()
    if (not show.process()):
        show.print_help()

And to be clear, you are already running python as root?

I was runnin thonny as a root. The python command line was inside thonny in this case

Hi Yes I get thte same issue running SampleBase in python from samples directory under OSMC (debian)
You cannot set thread resource priority on the pi - the limit is set to 0 .
Cyril:~/rpi-rgb-led-matrix/bindings/python/samples$ ulimit
0
(There are no limits set up on the raspberry pi in /etc/security/limits.conf )

ls -l /usr/bin/python3.7
-r-rwxr-xr-x 2 root root 3538304 Jul 25 2020 python3.7

Running the python process as root - maybe the sample.py has its own context?
ls -
l-rwxr-xr-x 1 osmc osmc 1146 Mar 27 11:49 runtext.py
-rwxr-xr-x 1 osmc osmc 4991 Mar 27 11:49 samplebase.py
-rwxr-xr-x 1 root root 5120 Mar 27 17:13 scroll.py

Will try chown samplebase.py…to root:root
sudo chown root:root samplebase.py

→ run text
Can’t set realtime thread priority=99: Operation not permitted.
You are probably not running as root ?
This will seriously mess with color stability and flicker
of the matrix. Please run as root (e.g. by invoking this
program with sudo), or setting the capability on this
binary by calling
sudo setcap ‘cap_sys_nice=eip’ /usr/bin/python3.7
Press CTRL-C to stop sample

Nope! Will have to look over what its trying to do