[Twisted-Python] Re: user interaction & the reactor

Lenny G Arbage alengarbage at yahoo.com
Thu Dec 1 17:53:43 EST 2005

Okay, I think I've got it now.  This:
combined with this:
contained some details I was woefully ignorant of.  

--- Lenny G Arbage <alengarbage at yahoo.com> wrote:

> Where can I find examples or instructions on
> combining
> the reactor with [command-line] user interaction? 
> I've been searching every resource I can, and know
> it
> must be possible based on threads like this one:
> .  I /can/ block on a call made from within the
> reactor while waiting for user's raw_input, but that
> doesn't allow me to give live feedback to the user
> from incoming status messages, and might cause
> problems if a large number of status messages arrive
> while the user is 'away'.  All the example clients I
> can find inside of twisted are not [user-]
> interactive
> (ftpclient, echoclient, simpleclient, etc).  Am I
> looking in the wrong place?  Have I missed a howto?
> Specifically I have a server that takes commands via
> a
> protocol I define and a client that sends commands
> to
> the server.  The commands on the server take some
> time
> (on the order of 20 seconds to many minutes) to
> complete or error out.  Once they do, status is sent
> back to the client, i.e., the user can issue many
> commands that are concurrently 'pending', completing
> when the server sends back status.
> I've started by running the client reactor in a
> thread, and then using the main thread to get input
> from the user.  Am I making this more difficult than
> it needs to be?  Is there some way to integrate user
> action (keyboard input) as events into the reactor's
> event model?  Or is there a better approach?

Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 

More information about the Twisted-Python mailing list