[Tutor] Set LD_LIBRARY_PATH and equivalents platform-independently

eryksun eryksun at gmail.com
Thu Jan 17 15:40:35 CET 2013


On Thu, Jan 17, 2013 at 7:14 AM, Albert-Jan Roskam <fomcl at yahoo.com> wrote:
>
> Thanks for your replies. os.putenv() may be easier than os.environ because,
> hopefully, it takes care of the OS-specific separators of the values (";"
> for Windows, ":" for Linux, others I don't know but I'd guess they're all
> ":").

os.environ wraps the initial posix.environ dict and uses
putenv/unsetenv to keep it consistent with the process:

http://hg.python.org/cpython/file/70274d53c1dd/Lib/os.py#l391

convertenviron in posixmodule.c (module posix, nt, or os2) populates
the initial dict:

http://hg.python.org/cpython/file/70274d53c1dd/Modules/posixmodule.c#l442

For the path separator, use os.pathsep or os.path.pathsep:

http://docs.python.org/2/library/os#os.pathsep


More information about the Tutor mailing list