Re: [Tutor] interactif or not

2005-06-07 Thread Alan G
> > look to see if stdin is a tty. Unix is usually very careful about who has a > > "controlling tty" and who does not. In Python, file objects have an isatty() > > method that will return True or False. > > > > import sys > > isinteractive = sys.stdin.isatty() > > if isinteractive: > > ... > > els

Re: [Tutor] interactif or not

2005-06-07 Thread Cedric BRINER
> If you want to know if your program has been launched from an interactive > terminal or from a system background process like cron or init, then you > look to see if stdin is a tty. Unix is usually very careful about who has a > "controlling tty" and who does not. In Python, file objects have

Re: [Tutor] interactif or not

2005-06-04 Thread Michael P. Reilly
On 6/3/05, Cedric BRINER <[EMAIL PROTECTED]> wrote: hi,How can I know if a script is launched interactively or not because I'd like to make a script verbose or not depending if it is executed as interactive or not.eg.If I invoke it in a shell.. then it can be verboseIf it is launched from a crontab

Re: [Tutor] interactif or not

2005-06-03 Thread ZIYAD A. M. AL-BATLY
On Fri, 2005-06-03 at 18:45 +0100, Alan G wrote: > > 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. Cr

Re: [Tutor] interactif or not

2005-06-03 Thread Alan G
> 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

[Tutor] interactif or not

2005-06-03 Thread Cedric BRINER
hi, How can I know if a script is launched interactively or not because I'd like to make a script verbose or not depending if it is executed as interactive or not. eg. If I invoke it in a shell.. then it can be verbose If it is launched from a crontab.. then it is less verbose. Ced. -- Ced