Problem running Python script as cron job

William R. Dickson wrd at awenet.com
Mon Apr 10 16:24:12 EDT 2000


In article <m3k8i5los8.fsf at atrus.jesus.cam.ac.uk>, Michael Hudson 
<mwh21 at cam.ac.uk> wrote:

> > > Try stderr?
> > > /path/prog > /path/log 2>&1
> > > 
> > > Maybe it spits some errors?
> > 
> > Tried that, but I still wind up with an empty log.  Anyway to force it 
> > to write immediately rather than buffering?
> 
> [mwh21 at atrus mwh21]$ python --bleargh
> Unknown option: --
> usage: python [option] ... [-c cmd | file | -] [arg] ...
> Options and arguments (and corresponding environment variables):
> -d     : debug output from parser (also PYTHONDEBUG=x)
> -i     : inspect interactively after running script, (also 
> PYTHONINSPECT=x)
>          and force prompts, even if stdin does not appear to be a 
>          terminal
> -O     : optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x)
> -OO    : remove doc-strings in addition to the -O optimizations
> -S     : don't imply 'import site' on initialization
> -t     : issue warnings about inconsistent tab usage (-tt: issue errors)
> -u     : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)
> -v     : verbose (trace import statements) (also PYTHONVERBOSE=x)
> -x     : skip first line of source, allowing use of non-Unix forms of 
> #!cmd
> -X     : disable class based built-in exceptions
> -c cmd : program passed in as string (terminates option list)
> file   : program read from script file
> -      : program read from stdin (default; interactive mode if a tty)
> arg ...: arguments passed to program in sys.argv[1:]
> Other environment variables:
> PYTHONSTARTUP: file executed on interactive startup (no default)
> PYTHONPATH   : ':'-separated list of directories prefixed to the
>                default module search path.  The result is sys.path.
> PYTHONHOME   : alternate <prefix> directory (or <prefix>:<exec_prefix>).
>                The default module search path uses <prefix>/python1.5.
> 
> so that'll be `python -u' then ...
> 
> Cheers,
> M.

Heh...dowh.  If you're ever in Seattle, I owe you a beer :).

-Bill



More information about the Python-list mailing list