From e913c0b0e2445954adda702424e337c31303ba6e 2012-04-15 11:30:26 From: Thomas Kluyver Date: 2012-04-15 11:30:26 Subject: [PATCH] Fix %env magic on Python 3. Closes gh-1201 --- diff --git a/IPython/core/magic.py b/IPython/core/magic.py index 70d700a..d3820d0 100644 --- a/IPython/core/magic.py +++ b/IPython/core/magic.py @@ -3006,7 +3006,7 @@ Defaulting color scheme to 'NoColor'""" def magic_env(self, parameter_s=''): """List environment variables.""" - return os.environ.data + return dict(os.environ) def magic_pushd(self, parameter_s=''): """Place the current dir on stack and change directory. diff --git a/IPython/core/tests/test_magic.py b/IPython/core/tests/test_magic.py index a6fc80a..e40682f 100644 --- a/IPython/core/tests/test_magic.py +++ b/IPython/core/tests/test_magic.py @@ -467,3 +467,6 @@ def test_notebook_reformat_json(): _ip.magic("notebook -f ipynb %s" % infile) _ip.magic("notebook -f json %s" % infile) +def test_env(): + env = _ip.magic("env") + assert isinstance(env, dict), type(env)