In a Python script, is there any way to tell if the interpreter is in interactive mode? This would be useful so that, for instance, when you run an interactive Python sessio
sys.ps1 and sys.ps2 are only defined in interactive mode.