0

Can anyone help me with this or some guidance for this, I need to display the output of the subprocess.popen in the browser in real time but i can make it work i know its possible but I've been searching for days for the answer but still no luck.

so far i have this running and im using eclipse as the IDE

views.py

def test1(request):
    p = subprocess.Popen(['ping', 'google.com'], stdout=subprocess.PIPE, bufsize=1)
    for line in iter(p.stdout.readline, b''):
        pr = print(line) 
    p.stdout.close()
    p.wait()
    return HttpResponse(pr)

I get this code in this link and it works fine but the output is just on the console window in eclipse and in the browser the output is None. I want to return the pr = print(line) in the browser if its possible.

thank you very much in advance :)

Community
  • 1
  • 1
  • possible duplicate of [Django - flush response?](http://stackoverflow.com/questions/1371020/django-flush-response) – André Laszlo Jan 21 '15 at 08:20
  • How do you expect this to work? It looks like you want to use django as a unix pipe or as a ssh replacement. – Håken Lid Jan 22 '15 at 12:54
  • I think so but I'm not really sure. I'm a little new in this kind of things, I'm trying to creating an application which i can execute Linux command via browser and return the output in the browser like using a terminal in a browser which returns the output in real time. – user2725518 Jan 26 '15 at 02:02

0 Answers0