Reading from stdin first, then use curses

Veritatem Ignotam veritatem.ignotam at gmail.com
Wed Sep 4 14:45:51 EDT 2013


I'd like to bump this. I asked a similar question a few weeks ago and
had no reply. Here's my question:

I'm fairly new to python and even newer to curses. Does any one have a
good solution for how to embed the output of a subprocess (ex.
subprocess.Popen("htop", stdout=subprocess.PIPE)) into an ncurses
window? So for example, the terminal window is broken up into quadrants
and the top right has htop running inside. I'd imagine this would
involve some kind of terminal emulation as the dimensions of the window
would need to be queried by htop.

If anyone could please point me in the right direction, I'd be very grateful

Thanks,

Ignotus


On 08/31/2013 04:31 AM, Timo Schmiade wrote:
> Hi again,
>
> sorry for replying to my own mail, but is there really no solution? Can
> curses really not be used in this situation?
>
> Thanks again,
>
> Timo
>
> On Sun, Aug 11, 2013 at 02:05:11PM +0200, Timo Schmiade wrote:
>> Hi all,
>>
>> I wrote a replacement for urlview to properly extract URLs from emails.
>> You can find the first draft here:
>>
>>   https://github.com/the-isz/pyurlview
>>
>> When I call it with an email file passed to the '-f' argument, it does
>> pretty much what I want already. However, I intend to use it in mutt,
>> which pipes the message to the program like so:
>>
>> macro pager \cu <pipe-entry>'pyurlview.py'<enter> 'Follow links with pyurlview'
>>
>> The problem is rather obvious but - unfortunately - not so easy to solve:
>>
>> * The program reads the mail from stdin
>> * The terminal in which it runs is a pseudo-terminal (pipe)
>> * curses is not able to accept user input from the pseudo-terminal
>>
>> The question is:
>>
>> How do I read from stdin first and afterwards allow curses to read user
>> input?
>>
>> Thanks in advance and kind regards,
>>
>> Timo




More information about the Python-list mailing list