This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author robert.ancell
Recipients robert.ancell
Date 2007-09-13.07:22:06
SpamBayes Score 0.015799789
Marked as misclassified No
Message-id <1189668127.19.0.0258251668017.issue1159@psf.upfronthosting.co.za>
In-reply-to
Content
The Python os.getenv() function accesses an Python dictionary which is
mirroring the process environment. This dictionary is populated when the
interpreter starts and updated when os.environ.__setitem__() or
os.putenv() are called. However if the python program imports an
extension module that uses the system putenv() then the changes cannot
be accessed using the Python standard library.

This has been a problem for us as we have created Python bindings to an
existing C based library that modifies the environment dynamically (not
the best design decision...). The workaround we are using is to create
our own wrapper to the system (Solaris/Linux) getenv().

A potential solution could be to make environ a class where
os.environ.__setitem__() calls putenv(), os.environ.__getitem__() calls
getenv() and os.environ.keys()/items()/iter*() uses **environ (or other
appropriate system call). This does however have undefined issues on how
the environment behaves on various systems (memory leaks etc).
History
Date User Action Args
2007-09-13 07:22:07robert.ancellsetspambayes_score: 0.0157998 -> 0.015799789
recipients: + robert.ancell
2007-09-13 07:22:07robert.ancellsetspambayes_score: 0.0157998 -> 0.0157998
messageid: <1189668127.19.0.0258251668017.issue1159@psf.upfronthosting.co.za>
2007-09-13 07:22:07robert.ancelllinkissue1159 messages
2007-09-13 07:22:06robert.ancellcreate