I am running an exe with python script which is called by the web browser.
Exe file is stored on server side. Exe file takes an input file and in output returns several text files. The python script running the exe is as follows:
import subprocess
print ("Hello I am in python script")
args = "/path/import.exe /path/input_file.txt -terms".split()
popen = subprocess.Popen(args, stdout=subprocess.PIPE)
popen.wait()
output = popen.stdout.read()
When I execute the python script individually it runs as expected and outputs several text files in cgi-bin folder.
But I want to run this exe file from my web browser, therefore I have placed this in cgi-bin folder on my xampp server.
On my web browser I enter the URL as follows: http://localhost/cgi-bin/script.py
The script is executed but I am not able to see expected output of the exe file which works perfectly fine otherwise in case of individual execution on terminal.
I have edited the httpd.conf file to allow .py files to be handled on web server. The script.py file has a path given to the python installed on system. Path given is absolute path. Permission given to exe file, script.py is chmod 777 as of now, for testing purpose.
I am unable to capture any error from the subprocess module of python. I have used stderr in the module but it does not print any information.