Bugs item #1110478, was opened at 2005-01-27 16:22 Message generated for change (Comment added) made by juneaftn You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1110478&group_id=5470
Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: June Kim (juneaftn) Assigned to: Nobody/Anonymous (nobody) Summary: os.environ.update doesn't work Initial Comment: os.environ.update doesn't really update os.environ -- it doesn't call putenv subsequently. This is the test code: #test1.py import os FILENAME='test2.py' env={};env['ENVIRON_UPDATE']='123';os.environ.update(env) os.environ['ENVIRON_DIRECT_SETTING']='123' cmdline='c:\python24\python.exe -u %s'%FILENAME fs=os.popen3(cmdline,'b') print fs[1].read() #test2.py import os if os.environ.has_key('ENVIRON_UPDATE'):print 'os.env.update worked' else:print 'os.env.update failed' if os.environ.has_key('ENVIRON_DIRECT_SETTING'):print 'os.env assignment worked' else:print 'os.env assignment failed' Run test1.py with python 2.4 on windows. The reason os.environ.update doesn't work is the update method is removed from 2.4. (It works with 2.3) Following is the patch: --- os.py Thu Jan 27 07:09:38 2005 +++ os_new.py Thu Jan 27 07:10:44 2005 @@ -435,6 +435,9 @@ return key.upper() in self.data def get(self, key, failobj=None): return self.data.get(key.upper(), failobj) + def update(self, dict): + for k, v in dict.items(): + self[k] = v def copy(self): return dict(self) @@ -446,6 +449,9 @@ def __setitem__(self, key, item): putenv(key, item) self.data[key] = item + def update(self, dict): + for k, v in dict.items(): + self[k] = v try: unsetenv except NameError: ---------------------------------------------------------------------- >Comment By: June Kim (juneaftn) Date: 2005-01-27 16:39 Message: Logged In: YES user_id=116941 The update methods in os.py were removed in the Revision 1.75. Thu Mar 4 08:25:44 2004 UTC according to the cvs. ---------------------------------------------------------------------- Comment By: June Kim (juneaftn) Date: 2005-01-27 16:22 Message: Logged In: YES user_id=116941 This is the cause of the cgi bug #1100235. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1110478&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com