2

I'm writing a simple web-based front-end for a Python console program that runs on a local machine. The interactions are extremely simple. Essentially, the web front-end needs to:

  1. Accept input from the user (through an AJAX form or something).
  2. Pass this input to the Python program and run it.
  3. Display the output of the Python console program while it is running, until it terminates.

The first two can be accomplished quite easily (though suitable AJAX library recommendations would be helpful).

Question: What Javascript library would I need to accomplish No. 3?


Remarks:

  • I am aware of packages like AJAXterm and Shellinabox, but instead of a full-shell, I just want to display the output of the Python console program; essentially I'd like a way to pipe Python's stdout to a web-page in real-time.

1 Answer 1

1

You are probably looking for a comet implementation or another server push protocol, because of the unpredictable timing of python code output. So on the server side you have a thread that is reading from your python process' stdout and pushing out the output to your client via comet.

cometd may be your best bet for the client & server components.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks to your comment, I found a CherryPy comet implementation that is simple and fits my needs. Thanks you!
@Gilead my pleasure, and yeah CherryPy rules!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.