On Nov 15, 9:48 am, [EMAIL PROTECTED] wrote:
> Thanks. I wasn't aware there was a documented way to check for
> interactivity.
That's more of a side-effect than the actual intent of those
attributes, which are there to hold the interpreter prompts. But it
does seem to be the only way.
It might
Peter> hasattr(sys, "ps1")
Thanks. I wasn't aware there was a documented way to check for
interactivity. It would have been more obvious if sys had an
"isinteractive" method or attribute.
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailm
[EMAIL PROTECTED] wrote:
> Is there a reliable way (this is on Solaris if that matters) to tell if
> I'm
> running in the interactive interpreter as opposed to in a script? I think
> examining sys.argv works, but wanted to double check.
hasattr(sys, "ps1")
http://www.python.org/doc/2.5.2/lib/mo
[EMAIL PROTECTED] wrote:
Is there a reliable way (this is on Solaris if that matters) to tell if I'm
running in the interactive interpreter as opposed to in a script? I think
examining sys.argv works, but wanted to double check.
import sys, traceback
try:
raise ValueError
Is there a reliable way (this is on Solaris if that matters) to tell if I'm
running in the interactive interpreter as opposed to in a script? I think
examining sys.argv works, but wanted to double check.
Thx,
Skip
--
http://mail.python.org/mailman/listinfo/python-list