Rock 4 se GPIO python problems

I cant get GPIO pins to work in jupyter notebook unless running jupyter in root on my rock 4 SE, then it works.

That causes other problems that I wish to avoid (im running speech to text, and in root the microphone wont work properly)

I am using the periphery python library . I can use another library if that will make it work. I tried to sudo chown /sys/class/gpio/export but it doesnt help.

How can I get GPIO to work when not in root account?

This is the error message I get: GPIOError: [Errno 13] Exporting GPIO: Permission denied

Thanks alot,
Jonas

You must allow other users to read/write to the export via a udev.

Place following content into following new: file /etc/udev/rules.d/99-com.rules

/bin/sh -c 'find -L /sys/class/gpio/ -maxdepth 2 -exec chown root:root {} \; -exec chmod 777 {} \; || true'