Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52383

Reading from stdin first, then use curses

Date 2013-08-11 14:05 +0200
From Timo Schmiade <the_isz@gmx.de>
Subject Reading from stdin first, then use curses
Newsgroups comp.lang.python
Message-ID <mailman.481.1376222719.1251.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Reading from stdin first, then use curses Timo Schmiade <the_isz@gmx.de> - 2013-08-11 14:05 +0200

csiph-web