Python without a tty

Hans Mulder hansmu at xs4all.nl
Thu Sep 29 07:39:25 EDT 2011


On 29/09/11 11:21:16, Steven D'Aprano wrote:
> I have a Python script which I would like to test without a tty attached
> to the process. I could run it as a cron job, but is there an easier way?

There is module on Pypi called python-daemon; it implements PEP-3143.
This module detaches the process from the tty and resets a number of
process attributes that are normally inherited.

You could start by reading the PEP to determine which of its features
are relevant to your situation.  It would provide you with a complete
list of aspects you'd need to think about.

If a third of what the module does is relevant to your situation and
the other two thirds do not hurt, then using the module is likely to
be less work than rolling your own.

Hope this helps,

-- HansM



More information about the Python-list mailing list