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


Groups > comp.lang.python > #79405

Re: Struggling with python-daemon and subprocess module to work together

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'say,': 0.05; 'suppose': 0.07; '(its': 0.09; 'executed': 0.09; 'if,': 0.09; 'kumar': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'definition.': 0.16; 'finney': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:python': 0.16; 'previously': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'controlling': 0.24; 'fine': 0.24; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'rest': 0.29; "doesn't": 0.30; 'code': 0.31; 'writes:': 0.31; 'file': 0.32; 'probably': 0.32; 'run': 0.32; 'running': 0.33; 'entirely': 0.33; 'subject:with': 0.35; 'basic': 0.35; 'case,': 0.35; 'but': 0.35; 'really': 0.36; 'options:': 0.36; 'so,': 0.37; 'two': 0.37; 'server': 0.38; 'ben': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'quote': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; "you're": 0.61; 'happen': 0.63; 'cut': 0.74; 'received:125': 0.84; 'subject:together': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben+python@benfinney.id.au>
Subject Re: Struggling with python-daemon and subprocess module to work together
Date Wed, 22 Oct 2014 11:04:39 +1100
References <CAK32T6WO=U-MUW01OEUtmxSv5bsxgQg+0P5k_ReaMaTjPQ6aBQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:NQ8hQs8Xv30tVcYSkX/ZrClz+xc=
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.15051.1413936295.18130.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1413936295 news.xs4all.nl 2918 [2001:888:2000:d::a6]:53003
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:79405

Show key headers only | View raw


Praveen Kumar <kumarpraveen.nitdgp@gmail.com> writes:

> Previously this basic server is executed using *openvt* but I thought
> it would be nice to have a daemon process for it and used
> python-daemon.

An important difference is that a daemon process has no controlling
terminal, by definition.

> Issue I am facing is after some time server will stop sending data to
> client which suppose to happen in #120 and get error message "Cannot
> run interactive console without a controlling TTY" .

So, if the code you're running inside that daemon process needs access
to a terminal, you have at least two options:

* If the code really needs to talk on an interactive terminal, fake it
  with a pseudoterminal, and keep that pseudoterminal (its file handle)
  open.

* If, as is probably the case, the code doesn't actually need to talk on
  an interactive terminal, cut that part of the code out entirely and
  the rest will run fine inside the daemon.

-- 
 \         “I may disagree with what you say, but I will defend to the |
  `\        death your right to mis-attribute this quote to Voltaire.” |
_o__)                   —Avram Grumer, rec.arts.sf.written, 2000-05-30 |
Ben Finney

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


Thread

Re: Struggling with python-daemon and subprocess module to work together Ben Finney <ben+python@benfinney.id.au> - 2014-10-22 11:04 +1100

csiph-web