0

I'm trying to execute python file made by CaryKH called jumpcutter.py using child process

This is a working function, where the exec command does work:

function executePython(){ const { exec } = require('child_process'); const path = require('path'); var input = document.getElementById('input').value var output = document.getElementById('output').value var silent = document.getElementById('silent').value var sounded = document.getElementById('sounded').value var margin = document.getElementById('margin').value alert(input) exec('python jumpcutter.py --input_file wow.mp4 --output_file wowcut.mp4 --silent_speed 999999 --sounded_speed 1 --frame_margin 1') } 

However, when I do this:

exec('python jumpcutter.py --input_file ' +input ' --output_file ' +output ' --silent_speed ' +silent ' --sounded_speed ' +sounded ' --frame_margin ' +margin) 

the code doesn't work entirely, so even the alert no longer works, even though it did prior. I have already tried to store the console command in a variable called text but to no prevail.

Thank you in advance for any assistance :)

1 Answer 1

1

the string concatenate is wrong

to concatenate multiple strings into one the syntax is:

string1 + string2 + string3 + string4 + .... 

so your code should be like this:

exec('python jumpcutter.py --input_file ' + input +' --output_file ' +output+ ' --silent_speed ' +silent+ ' --sounded_speed ' +sounded+ ' --frame_margin ' +margin) 
Sign up to request clarification or add additional context in comments.

1 Comment

I just realised this and was about to answer, it was a very silly mistake and it shouldn't have happened if I payed more attention. Regardless than youo for answering and I will be sure to remember this for later!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.