Running script fron Python Editor [SOLVED]



I am new to the Grove and have the following problem:

I can run the scripts delivered with the package from LXTerminal when I provide the suod command.
However, when I want to work on the Python programs using Geany it generateds an error when I run the program.
I receive the error [Errno 13] Permission denied.

This is of course very annoying since I have to store the program, open LXTerminal, change directories and issue the full comman.

How can I avoid this problem.

Kind regards,


I’ve suffered at the hands of python IDEs for a while, and this sounds very familiar.

First, never use IDEs. Use an editor. IDEs are not worth the trouble, and I was a huge fan of them for 20 years before dumping them.

Here is likely the issue: I/O is not really supported in a lot of IDEs. If you need user input, in particular, it’s not possible, and a random, meaningless error message will result. In fact, the default IDE that usually installs with python (IDLE) WILL NOT work with input from the user.


All great points bigbuilder.

First, python programs on the Pi that call I2C or other hardware level calls require sudo. It’s possible that genie or whatever IDE yuo’re using is not calling sudo before trying to execute. You can look into how Genie is being opened or other IDE is being opened, it should be with sudo.

You can certainly use Genie or other editors to quickly edit the python file, but your best path to executing the python program is to call it from the command line with sudo. When I work remotely on a Pi, I usually just open up another terminal instance to execute, it makes it pretty easy to call over and over again as you save and test (just press the up arrow button).

My two cents. John



Thanks for your answer.
However, I found a solution to start Geany with sudo automatically.
In that way all Python programs that are initiated from Geany will work.

Kind regards,


Hey Freddy,
Can you post the solution here too so that it might hep others too.



Hi Karan,

I will try to explain it. It is fairly easy.
I am running on a Raspberry 2Pi with the GrovePi board, but that does not matter.

From the desktop.
Go to the [Menu} and right click the icon of your program and select [Properties].
Two tabs are now visible.
Select [Desktop Entry]
Tehre is now an area where you are able to type the start command for your program.
Just type "sudo " in front of it and close the window.

That’s it.