Linked Questions

Popular Questions

Redirect command to gnome-terminal from python code

Asked by At

I have my code which includes few lines:

print("python kaldigstserver client.py -r 32000 ",self.filename,file=open("output.txt", "a"))
       with open('output.txt') as my_file:
         file_text = my_file.read()  
         print(file_text)

subprocess.Popen(args=["gnome-terminal", "--working-directory=/home/huma/G-str/kaldi-gstreamer-server"])

This opens a terminal when I execute my python program...... But I want to redirect the command from the text file to the terminal.... i.e. output.txt. and execute it automatically.

I don't know how to do that. I tried it with "--command"& "--execute" but it is not working. Is there any way to do it ????

Thanks in advance.

Related Questions