1

I'm trying to use the keyboard library within Thonny on my Raspberrypi Zero W. However I receive an error saying "import error: you must be root to use this library on Linux."

Can Thonny run scripts as root to avoid this error?

screen_image

Ryan M
  • 18,333
  • 31
  • 67
  • 74
Sir.Socks
  • 179
  • 1
  • 5

3 Answers3

1
  • Go to menu right click on Thonny menu item.
  • Click on properties
  • Click on the tab 'Desktop Entry'
  • Change the 'Command' field to sudo /usr/bin/thonny %F
  • Click on OK button.
  • Close and open Thonny.
  • Important: You are running Thonny as root, which means when you click on the save/load button it will by default show the Home of the root user. Make sure you choose your default user ( usually the pi folder )
Dami
  • 677
  • 6
  • 12
0

If you run Thonny as root you can.

So open a terminal and enter sudo Thonny

-1

Open a terminal and use sudo python program.py to start the program.

Shraft
  • 332
  • 1
  • 5