[Twisted-Python] how can i connect curses getch function and a process launched with spawnprocesss?
exarkun at divmod.com
Tue Jan 2 15:10:28 MST 2007
On Tue, 2 Jan 2007 23:06:08 +0100, Gabriel Santonja <gsantonja at free.fr> wrote:
>first : Happy new year 2007.
>second : I have some difficulties with curses getch() function and process launch
>I'm newbie in Twisted so i'm using the curses example who work fine with irc factory.
>i'm using the process howto too
>But when i try to send a message to a process with a
> >>> self.transport.writeSequence(contents+"\n")
You probably want to just use write() here. writeSequence is for
lists of strings. Of course, it works for regular strings too, but
there's little point.
>It's work fine with deferred but never with the curses.getch()
>i need a loop like that :
> - a caracter is push on the keyboard
> - getch function of curses send it
> - this event is processing
> - a message is send to the process (launch by spawnprocess) who is concerned
> - a result is send by the process and he is processing by the program
>i think I need to work with the reactor but i do not know how.
>I have trie all i can imagine but nothing work. Could you help me?
It may be worth passing usePTY=True to spawnProcess. I'm not sure what
curses' requirements are exactly, but I wouldn't be surprised if it wanted
something vaguely terminal like: the default with spawnProcess is to set
up something that looks more like a shell redirection.
More information about the Twisted-Python