0

I am new to programming, so I bearly have any unix experience at all. And I don't even know if that would have helped me right now.

I want to write a program that when given a input, lets say "enter". It should call for a software already installed on the Pi. Software that allows it to take pictures.

I know how to take pictures from the terminal. But I don't know how to write commands to the terminal from my own code.

Do anyone know where I can find usefull information about writing these kinds of software? I have looked but I might have missed some keywords in my googling.

G.O.A.T
  • 69
  • 1
  • 8
  • 2
    _"But I don't know how to write commands to the terminal from my own code."_ Try [`subprocess`](https://docs.python.org/2/library/subprocess.html). – Kevin Mar 31 '14 at 12:23
  • @Kevin I think by *terminal* he means the SSH client that he uses to connect to his RPi, in this case it's probably best to use [this](http://stackoverflow.com/a/3586168/2629998). –  Mar 31 '14 at 12:25
  • @Kevin Thanks, I'll look into it. André It's not that complicated yet. But the project might become that advanced. – G.O.A.T Mar 31 '14 at 12:32

2 Answers2

2

You can say:

import os
os.system("your command line expression")

To run a terminal command from inside of a python program.

austin-schick
  • 1,225
  • 7
  • 11
0

This page has documentation that will help you:

https://docs.python.org/2/library/subprocess.html

You can use subprocess to start other programs from your python script.

Amandil
  • 473
  • 4
  • 8