Error when trying to get shell environment variables from within a Jython script.

Reason: This is because you are tryinf to reference a dictionary pobject with no key

Bad code:

    for environ in os.environ:
        print environ

Good code:

    for param in os.environ.keys():
        print "%20s %s" % (param,os.environ[param])
Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply