Activating `-i' from inside a script?

Skip Montanaro skip at pobox.com
Fri Jun 27 07:47:02 EDT 2003


    Troy> I thought this would work, but it doesn't:

    Troy> import os

    Troy> if __name__ == '__main__':
    Troy>     discrepancy = True
    Troy>     if discrepancy:
    Troy>         os.environ['PYTHONINSPECT'] = "why yes, i'd like that"

    Troy> A quick read of Modules/main.c shows that the environment variable
    Troy> is checked at program start, not at end.  Maybe this is a bug?

The slight, obvious rearrangement to Modules/main.c seems to work.  I'll
propose it on python-dev.

Skip





More information about the Python-list mailing list