I am learning django. I am stuck with this problem.
So basically, I have designed a form (template) in HTML that takes a text file as input and generates a voiceover of that text file. I am using espeak
for it in the backend. So, when a user uploads a file, this command espeak -ven+m1 -f sample.txt
where sample.txt
is the name of the uploaded file should run in a new terminal window.
As you can see in the above image this is what I want to achieve.
espeak -ven+m1 -f sample.txt
I want to print the above line in a new terminal window.
Here, sample.txt
is the name of the text file. I want to achieve this by the python program instead of doing it manually.
As I already said I am new to django and some help will be appreciated.
Edit:
I tried to run this command
subprocess.run(['gnome-terminal', '--', f"espeak -ven+m1 -f {uploaded_file.name}"])
But the output I am getting is this
There was an error creating the child process for this terminal
Failed to execute child process “espeak -ven+m1 -f sample.txt” (No such file or directory)
Also please note that Run a custom command instead of my shell
checkbox is untick
subprocess.run
or similar to rungnome-terminal -x espeak ...
, instead of usingprint()
to just show the command you're running.