Page 1 of 1

Execute shell commands from a phyton script

Posted: Sun Feb 15, 2015 9:27 am
by juxrez
Hi, im working on a little task with Raspberry, the deal is: I need to do a Reset Button, not with the RUN pins, i need a script that execute a shell command when i press a button on GPIO pin. So, im not asking for code, just ideas to do the best way my little project. Thank you so much guys!
Have nice day!

Re: Execute shell commands from a phyton script

Posted: Sun Feb 15, 2015 11:51 am
by mahjongg
the RUN pins ARE for attaching a reset button....
Press the reset/run button, and it resets, release the button and it runs.

also you are asking for a script, but not for code, but a script IS code.

Re: Execute shell commands from a phyton script

Posted: Sun Feb 15, 2015 4:54 pm
by juxrez
mahjongg wrote:the RUN pins ARE for attaching a reset button....
Press the reset/run button, and it resets, release the button and it runs.

also you are asking for a script, but not for code, but a script IS code.
Im asking for wich function or metod is the best way to do this Job, as i said, im still learnig. Thanks again!

Re: Execute shell commands from a phyton script

Posted: Sun Feb 15, 2015 4:58 pm
by Laurens-wuyts
You can use Popen from the subprocess module.
https://docs.python.org/2/library/subpr ... onstructor

Laurens