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


Groups > comp.lang.python > #53644

Re: Reading from stdin first, then use curses

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <veritatem.ignotam@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'broken': 0.04; 'output': 0.05; 'advance': 0.07; 'already.': 0.09; 'url:github': 0.09; 'window?': 0.09; 'runs': 0.10; 'python': 0.11; 'wrote': 0.14; 'afterwards': 0.16; 'argument,': 0.16; 'bump': 0.16; 'emulation': 0.16; 'subject:Reading': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'all,': 0.19; 'properly': 0.19; 'input': 0.22; 'aug': 0.22; 'header:User-Agent:1': 0.23; 'fairly': 0.24; 'question': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'draft': 0.30; 'newer': 0.30; "i'm": 0.30; 'asked': 0.31; 'reply.': 0.31; "skip:' 10": 0.31; 'dimensions': 0.31; 'embed': 0.31; 'extract': 0.31; 'question:': 0.31; 'anyone': 0.31; 'file': 0.32; 'this.': 0.32; 'weeks': 0.32; 'running': 0.33; 'ago': 0.33; "i'd": 0.34; 'subject:from': 0.34; 'could': 0.34; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; '+0200,': 0.36; 'grateful': 0.36; 'thanks': 0.36; 'similar': 0.36; 'example,': 0.37; 'message-id:@gmail.com': 0.38; 'window': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'even': 0.60; 'skip:u 10': 0.60; 'read': 0.60; 'easy': 0.60; 'new': 0.61; 'received:173': 0.61; 'first': 0.61; 'here:': 0.62; 'kind': 0.63; 'mail,': 0.68; 'reads': 0.68; 'obvious': 0.74; 'emails.': 0.78; 'imagine': 0.93; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=P+41inKHQqRsyuGTg4Za8K+mEt9bT6FVWXoHFoYlbNo=; b=PHGr2+FqJzFsxqMHzYtIb8L/fEW/gvUgXDxZGSJ/QQzV9wHBRiFYPMPb4ul0QYe4jD r2zKYbg7GYcdmEuJbhXkr3CzNZvkdw4Cmx13i/+5L8h7VcTN159Ok5dBEmbh4hjC1YHM 4hNfttNBg9/5fvfz/qe7rPHAyM7dVoWGbH20Be+ceSjlMdxqFjb9X8jZKmDPWCj7SIwh K0X1W75qx+PidrSSkWbiSorF8/TKyyHbWsAe/XH8q2w68A/oHHLj3sZUp6hTvAXiXQm4 hb7EpRZ+t3R2SEaJtPBHPin9IVQcEixOzy9EHVdD/6BxMyPv090ej3qZm07UP3mm1yUo jgig==
X-Received by 10.49.131.200 with SMTP id oo8mr5296590qeb.0.1378320289368; Wed, 04 Sep 2013 11:44:49 -0700 (PDT)
Date Wed, 04 Sep 2013 14:45:51 -0400
From Veritatem Ignotam <veritatem.ignotam@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7
MIME-Version 1.0
To python-list@python.org
Subject Re: Reading from stdin first, then use curses
References <20130811120511.GA8223@Discworld.fritz.box> <20130831083103.GA570@Discworld.fritz.box>
In-Reply-To <20130831083103.GA570@Discworld.fritz.box>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Mailman-Approved-At Wed, 04 Sep 2013 21:18:28 +0200
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.54.1378322309.5461.python-list@python.org> (permalink)
Lines 57
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1378322309 news.xs4all.nl 15876 [2001:888:2000:d::a6]:37159
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:53644

Show key headers only | View raw


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

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


Thread

Re: Reading from stdin first, then use curses Veritatem Ignotam <veritatem.ignotam@gmail.com> - 2013-09-04 14:45 -0400

csiph-web