Python without a tty

Hans Mulder hansmu at xs4all.nl
Mon Oct 3 01:39:58 EDT 2011


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
>>>> easier way?
> [...]
>> I suspect that the OP just wants e.g.:
>>
>> 	script.py&>/dev/null<&-
>>
>> which will redirect stdout and stderr to /dev/null and close stdin.
>
>
> No, that's not what I wanted.
>
> I ended up just running the script as a cron job. It was a one-off (well,
> twice actually, since the first time demonstrated a bug in my code) test
> of some code that tries to determine the size of the current terminal. I
> wanted to ensure that it would do the right thing when run without a tty,
> such as from a cron job.

In that case, the "at" command would have been the answer.
It is a bit like cron, but meant for one-off jobs.

You might have received more useful answers if you'd
mentioned you goals earlier.

-- HansM




More information about the Python-list mailing list