0

I have been attempting, with little success, to open a terminal or konsole window from python and to insert commands into the terminal or konsole window.

So far, I have the following:

import os

os.system('konsole')

I cannot seem to figure out how to pipe the commands from the python prompt window to the terminal or konsole window.

This may help. I am trying to run commands from python into R (stats programming language). i.e. open konsole from python -> have letter R typed into the konsole so that R will start in the konsole -> insert R commands, coded in a python script, into the konsole running R. If anyone has an easier idea could you please share.

Many thanks.

Arnold
  • 1
  • 2
    Do you actually need the console to opened with the typed R commands, or do you just need to execute some commands in R? – Michael Mior Jul 07 '11 at 03:26

1 Answers1

6

If all that you need python for is to send commands to R, why not use RPy2 ? Else, try writing your commands to a temp file, invoke R in batch mode with the file and then flush it. PS: You might want to check this question as well for pointers.

Community
  • 1
  • 1
techiev2
  • 298
  • 1
  • 8