Detecting whether a Python program was invoked in the background or foreground
Oleg Broytmann
phd at phd.pp.ru
Thu Oct 11 11:04:01 EDT 2001
On Thu, Oct 11, 2001 at 02:44:16PM +0000, Kevin Smith wrote:
> Is it possible to detect whether a Python program was invoked in the
> background? In other words, is there a variable that will differ when
> invoking the following commands.
>
> python myscript.py &
> python myscript.py
There is no. What do you want to detect? Whether stdout is a console?
Use sys.stdout.isatty boolean variable.
Oleg.
----
Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-list
mailing list