简体   繁体   中英

Running window apps from python cgi script

I'm developing small application with web interface for automatic test and upgrade my hardware products. Application uses Apache 2 web server and CGI technology (python language). At one point I have to run external windows application (TeraTerm Pro for Zmodem file transfer). Python code:

pipe=subprocess.Popen("run_me.bat", shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

TeraTerm doesn't start. Well, it starts (I see it in process list), but window doesn't show up and nothing happens. When I start python script from windows command like, when cmd.exe is started up line this Start->Run... cmd.exe and type "python.exe transfer.py", everything works fine, TeraTerm windows shows up, and file transfer begins.

I've found partial solution. When I start Apache2 as user in Windows console window everything works file. When Apache2 runs as service - problem occurs. I've noticed that when Apache2 is running as service, there is no problem with running console application. There is a problem with running window based applications.

Is it possible to have Apache2 as service and run any window application without a problem? Partial solution is not acceptable because during normal work, many console windows shows up for a half of a second. It's quite disturbing.

I found solution. There is an option "allow service to interact with desktop" in tab "Log On" in service properties. After checking it out, and restarting Tera Term Works fine. Tera Term window does not apear. Solved!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM