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

2014-10-21 Thread Ben Finney
Praveen Kumar  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

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-21 Thread Dan Stromberg
On Mon, Oct 20, 2014 at 2:16 AM, Praveen Kumar
 wrote:
> I am writing a very basic server side application[0] which get data
> from a client and create a virtual machine using provided data and
> also tells client about what's going on during *virt-install* command
> execution. 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.
>
> 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" . I am not able to
> figure out issue is occurred due to module or I missed something
> during daemon initialization.

I believe you either want a pty, to make your interactive application
believe it's on a tty, or a redesign.

Here's some Python pty code:
http://stromberg.dnsalias.org/~strombrg/pypty/

I imagine pexpect might help too, though I tend to favor going
directly to a pty.

HTH
-- 
https://mail.python.org/mailman/listinfo/python-list


Struggling with python-daemon and subprocess module to work together

2014-10-21 Thread Praveen Kumar
Hi,

I am writing a very basic server side application[0] which get data
from a client and create a virtual machine using provided data and
also tells client about what's going on during *virt-install* command
execution. 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.

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" . I am not able to
figure out issue is occurred due to module or I missed something
during daemon initialization.



[0] http://fpaste.org/143455/

-- 
Praveen Kumar
http://fedoraproject.org/wiki/User:Kumarpraveen
http://fedoraproject.org/
http://kumar-pravin.blogspot.com
-- 
https://mail.python.org/mailman/listinfo/python-list