From d6fc8207b21633436d5af1bb1bbdd23e300c2b5f 2014-11-18 18:55:12 From: Thomas Kluyver <takowl@gmail.com> Date: 2014-11-18 18:55:12 Subject: [PATCH] %set_env should ensure environment variables are bytes on Python 2 Should fix test failures on Python 2 + Windows --- diff --git a/IPython/core/magics/osm.py b/IPython/core/magics/osm.py index 729fcb7..0bc533e 100644 --- a/IPython/core/magics/osm.py +++ b/IPython/core/magics/osm.py @@ -413,7 +413,7 @@ class OSMagics(Magics): err = "refusing to set env var with whitespace: '{0}'" err = err.format(val) raise UsageError(err) - os.environ[var] = val + os.environ[var] = py3compat.cast_bytes_py2(val) print('env: {0}={1}'.format(var,val)) @line_magic