-1
stdout = check_output(["./cl_download.sh '/session.txt'"]).decode('utf-8')

I am trying to pass the file session.txt as an argument to shell script in flask. Getting errors while running the script. However the script runs successfully when no argument is passed.

Is there any way to pass the file name as an argument to shell script in flask ?

davidism
  • 121,510
  • 29
  • 395
  • 339
neel jain
  • 23
  • 7

1 Answers1

0

You can use two built-in python modules for this one is os and another is subprocess

Using subprocess:

import subprocess
subprocess.call(['sh','cl_download.sh','session.txt'])

Using OS

 import os
 os.system('sh ./cl_download.sh /session.txt')

Hope this helps

Tony Frank
  • 248
  • 1
  • 2
  • 8