[Tutor] interactif or not

Alan G alan.gauld at freenet.co.uk
Fri Jun 3 19:45:32 CEST 2005


> If I invoke it in a shell.. then it can be verbose
> 
> If it is launched from a crontab.. then it is less verbose.

You need to check who the process owner is.

That can be done on *Nix by reading the USER environment 
variable. Cron jobs are usually run under the 'cron' user
I believe.

Hoever that won;t work if the python script is executed 
in a shell script that is then executed by a user. Its usually 
better to make verbosity controllable by a flag 
- traditionally -v. Thus the default is non verbode and 
verbosity can be switched on(or even given any one of 
several levels) as desired.

Alan G.




More information about the Tutor mailing list