Python without a tty

Roy Smith roy at panix.com
Thu Sep 29 09:28:35 EDT 2011


In article <4e84388c$0$29965$c3e8da3$5496439d at news.astraweb.com>,
 Steven D'Aprano <steve+comp.lang.python at 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?

I'm not sure what you mean by "without a tty attached to the process".  
If you mean no file descriptors attached to your control terminal, then 
some variation on

foo.py < /dev/null > /dev/null

(as others has suggested) might be good enough.  Or, are you talking 
about control terminals in the process control sense?  In that case, you 
might want to look at the "at" or "batch" commands, which do very much 
the same thing as cron, but without the overhead of having to edit the 
cron file to get things going.



More information about the Python-list mailing list