Reading from stdin first, then use curses
Antoon Pardon
antoon.pardon at rece.vub.ac.be
Sun Sep 1 16:36:46 EDT 2013
Op 11-08-13 14:05, Timo Schmiade schreef:
> 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?
>
Well you could close fd 0. Then open /dev/tty en dup the fd to 0.
Then start curses.
--
Antoon Pardon
More information about the Python-list
mailing list