how to open a new bash window from python and insert commands into the new bash window
Question: 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.


Answer: If all that you need python for is to send commands to R, why not use
[RPy2](http://rpy.sourceforge.net/rpy2.html) ? Else, try writing your commands
to a temp file, invoke [R in batch
mode](http://stat.ethz.ch/R-manual/R-patched/library/utils/html/BATCH.html)
with the file and then flush it. PS: You might want to check [this
question](http://stackoverflow.com/questions/6434569/a-question-about-execute-
an-r-script-in-python) as well for pointers.

