On Feb 6, 8:26 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello, > > I am trying to write a python cgi that calls a script over ssh, the > problem is the script takes a very long time to execute so Apache > makes the CGI time out and I never see any output. The script is set > to print a progress report to stdout every 3 seconds but I never see > any output until the child process is killed. > > Here's what I have in my python script: > > command = "ssh -l root %s /scripts/xen/xen-create-win-vps1.sh %s" % > (host, domuname) > output = os.popen(command) > for line in output: > print line.strip() > > Here's a copy of the bash script. > > http://watters.ws/script.txt > > I also tried using os.spawnv to run ssh in the background and nothing > happens. > > Does anybody know a way to make output show in real time?
Just a little note: os.popen has been replaced by the subprocess module. ;D -- http://mail.python.org/mailman/listinfo/python-list