Python without a tty

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Oct 3 00:37:43 EDT 2011


On 2011年9月30日 21:09:54 +0100, Nobody wrote:
> On 2011年9月29日 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.
Thanks to everyone who replied.
-- 
Steven


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /