Issue
So I have a new problem that's a little bit weird, I'm trying to open an external program in Flask (the program is written in C++ but compiled as a .exe file ), I can run it with cmd, I can run it with clicking on it and both of them works fine, but when I try to open them with python, the program window starts in my windows and then stops immediately I can't even see it for 1 sec. About my C++ Program, it reads some inputs for some text file, and then create some more text file after reading. I've already used: subprocess.call, subprocess.Popen, os.startfile, os.system. and I know my Program address is valid, because my app start but it stops immediately. there is no error in python, no error in cmd while using os.system etc. I would love to get any suggestions. current code:
if request.method == 'POST' and 'checkbox' in request.form:
if request.form.get("checkbox") is not None:
os.startfile(r"C:\Users\Administrator\flaskProject\upload\19\29\engine\engine.exe")
Solution
I've found a solution for my case, I think there is a problem with Flask upload module, my C++ program was on the same path as my uploaded files from flask, so when I changed the program path and used Windows command prompt to start the program, everything worked like a charm.
Answered By - Morteza
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.