On Mon, 03 Oct 2011 22:04:26 +1300, Gregory Ewing wrote:
>> os.setsid()
>
> *This* is what's losing the tty. According to the Fine Man Page:
>
> DESCRIPTION
> The setsid function creates a new session. The calling process is the
> session leader of the new session, is the process g
Hegedüs wrote:
If you fork() your process, then it will also loose the tty...
Um, no, fork() doesn't do that, as far as I know.
os.setsid()
*This* is what's losing the tty. According to the Fine Man Page:
DESCRIPTION
The setsid function creates a new session. The calling process is
hello,
On Mon, Oct 03, 2011 at 09:28:27AM +0200, Hans Mulder wrote:
> On 3/10/11 08:10:57, Hegedüs, Ervin wrote:
> >
> >If you fork() your process, then it will also loose the tty...
>
> Errhm, I suggest you check again. This cannot be true.
>
> >os.setsid()
>
> It is os.setsid() that makes yo
On 3/10/11 08:10:57, Hegedüs, Ervin wrote:
hello,
On Mon, Oct 03, 2011 at 04:37:43AM +, Steven D'Aprano wrote:
I wanted to ensure that it would do the right thing when run without a tty,
such as from a cron job.
If you fork() your process, then it will also loose the tty...
Errhm, I su
hello,
On Mon, Oct 03, 2011 at 04:37:43AM +, Steven D'Aprano wrote:
>
> I wanted to ensure that it would do the right thing when run without a tty,
> such as from a cron job.
If you fork() your process, then it will also loose the tty...
import os
import sys
try:
pid = os.fork()
On 3/10/11 06:37:43, Steven D'Aprano wrote:
On Fri, 30 Sep 2011 21:09:54 +0100, Nobody wrote:
On Thu, 29 Sep 2011 11:53:12 +0200, Alain Ketterlin 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
easie
On Fri, 30 Sep 2011 21:09:54 +0100, Nobody wrote:
> On Thu, 29 Sep 2011 11:53:12 +0200, Alain Ketterlin 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?
[...]
> I suspect that th
On 30/09/11 20:34:37, RJB wrote:
You could try the old UNIX "nohup ...&" technique for running a
process in the background (the&) with no HangUP if you log out:
$ nohup python -c "import sys,os; print
os.isatty(sys.stdout.fileno())"&
appending output to nohup.out
$ cat nohup.out
False
But that
On Thu, 29 Sep 2011 11:53:12 +0200, Alain Ketterlin 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?
>>
>> I am running Linux.
>
> Isn't os.setsid() what you're looking for? It makes th
On Sep 29, 3:52 am, Steven D'Aprano wrote:
> Alain Ketterlin wrote:
> > Steven D'Aprano writes:
>
> >> 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?
>
> >> I am running Linux.
>
> > Isn't os.
ron writes:
> On Sep 29, 5:21 am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> 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?
>
> Have you tried GNU Screen? It let's you run pr
On Sep 29, 5:21 am, 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?
>
> I am running Linux.
>
> --
> Steven
Have you tried GNU Screen? It let's you run processes under vi
> It doesn't appear so to me.
>
> [steve@sylar ~]$ tty
> /dev/pts/16
> [steve@sylar ~]$ setsid tty
> /dev/pts/16
>
> [steve@sylar ~]$ python -c "import sys,os; print
> os.isatty(sys.stdout.fileno())"
> True
> [steve@sylar ~]$ setsid python -c "import sys,os; print
> os.isatty(sys.stdout.fileno())"
On 29/09/2011 10:21, 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?
I am running Linux.
Well you could double fork and drop the parent, that would lose the tty
which is
In article <4e84388c$0$29965$c3e8da3$54964...@news.astraweb.com>,
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?
I'm not sure what you mean by "without a tty attached
Steven D'Aprano writes:
> 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?
>
> I am running Linux.
You could crib from the ‘python-daemon’ library implementation
http://pypi.python.org/pypi/pyth
Steven D'Aprano writes:
> Alain Ketterlin 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?
>> Isn't os.setsid() what you're looking for?[...]
> It doesn't appear so to me.
[...]
> [
On 29/09/11 12:52:22, Steven D'Aprano wrote:
[steve@sylar ~]$ python -c "import sys,os; print os.isatty(sys.stdout.fileno())"
True
>
If I run the same Python command (without the setsid) as a cron job, I
get False emailed to me. That's the effect I'm looking for.
In that case, all you need t
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
Alain Ketterlin wrote:
> Steven D'Aprano writes:
>
>> 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?
>>
>> I am running Linux.
>
> Isn't os.setsid() what you're looking for? It makes the calli
Steven D'Aprano writes:
> 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?
>
> I am running Linux.
Isn't os.setsid() what you're looking for? It makes the calling process
have no controlling term
On 29/09/11 11:21, 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?
>
> I am running Linux.
>
./program /dev/null 2>&1
--
http://mail.python.org/mailman/listinfo/python
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?
I am running Linux.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
23 matches
Mail list logo