I need to run a command using python code and I tried to use both os.system and subprocess however both didn't work for some reason. Here's my code:
@app.route('/run-script')
def run_script():
subprocess.call('python3.6 GoReport.py --id 31-33 --format word', cwd="working_dir", shell=True)
return flask.render_template('results.html', **locals())
Running this command from terminal directly works as it should. Trying to reproduce this from python interpreter using command line works as as a charm as well. However it doesn't work when I use Flask. What's the reason for this?