Sorry, messed up the line breaks once more.
---

> > +
> > +    # The variable is not deleted from the environment unless
> > function
> > +    # 'os.unsetenv()' exists. If it does not, we set it to the empty
> > string.
> > +    if not hasattr(os, 'unsetenv') and hasattr(os, 'putenv'):
> > +        os.putenv(name, '')
>
> Shouldn't this have the same effect?
>
> os.environ[name] = ""
> del os.environ[name]

Maybe, but I am not sure. The automatic call to "unsetenv" (provided
it is supported by the platform) is not documented until Python 2.5,
so we cannot be sure that "unsetenv" is automatically called prior to
2.5.

Therefore, we would have to do like this instead:

os.environ[name] = ""
del os.environ[name]
if not hasattr(os, 'unsetenv') and hasattr(os, 'putenv'):
  os.putenv(name, '')

But then the first line is not needed anymore, and you end up with my
suggestion (if I have not overlooked something):

del os.environ[name]
if not hasattr(os, 'unsetenv') and hasattr(os, 'putenv'):
  os.putenv(name, '')

/Martin

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyinstaller?hl=en.

Reply via email to