tags:

views:

525

answers:

2

I am currently developing a simple application in python that connects to a server. At the moment, it's single-threaded (as multithreading is not currently required).

However I would like - for debugging, maintenance and such to also be able to have a REPL via stdin.

How do I go about that, if possible? Will I need to keep anything in mind? Will I have to make a separate thread for it?

+3  A: 

You either need to go non-blocking or use a thread.

I would personally use Twisted for concurrency, which also offers a REPL-protocol which is easy to integrate.

truppo
+1: twisted also offers the manhole - a service where you can SSH to your application and get a REPL to interact with it while it is running!
nosklo
I'm going to give this a go. Sounds like what I need.
Adi
+1  A: 

Maybe this question could help. You can modify it a bit to create a customized REPL.

Sebastjan Trepča