[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
    except ValueError:
        start = traceback.extract_tb(sys.exc_info()[2])[-1]

Start should show you where the program is being run from.


--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to