Re: Can I check if I'm running from the interpreter prompt?

2008-11-14 Thread alex23
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

Re: Can I check if I'm running from the interpreter prompt?

2008-11-14 Thread skip
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

Re: Can I check if I'm running from the interpreter prompt?

2008-11-14 Thread Peter Otten
[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

Re: Can I check if I'm running from the interpreter prompt?

2008-11-14 Thread Scott David Daniels
[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

Can I check if I'm running from the interpreter prompt?

2008-11-14 Thread skip
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