ipython/ipython — Issue #1201: %env magic fails with Python 3.2
Author: ColMcp
Created: 2011-12-23 12:39:49+00:00
State: open

%env magic command fails with Python 3.2 because os.environ does not have an attribute called "data" - see traceback below.
Platform is Python 3.2.2, IPython 0.12, Mac OS X 10.7.2

Traceback
--------------
Python 3.2.2 (v3.2.2:137e45f15c0b, Sep 3 2011, 17:28:59)
Type "copyright", "credits" or "license" for more information.

IPython 0.12 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

In [1]: %env

AttributeError Traceback (most recent call last)
/Users/colin/Python/readline-6.2.1/ in ()
----> 1 get_ipython().magic('env')

/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/ipython-0.12-py3.2.egg/IPython/core/interactiveshell.py in magic(self, arg_s, next_input)
1997 self._magic_locals = sys._getframe(1).f_locals
1998 with self.builtin_trap:
-> 1999 result = fn(magic_args)
2000 # Ensure we're not keeping object references around:

2001 self._magic_locals = {}

/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/ipython-0.12-py3.2.egg/IPython/core/magic.py in magic_env(self, parameter_s)
2923 """List environment variables."""
2924
-> 2925 return os.environ.data
2926
2927 def magic_pushd(self, parameter_s=''):

AttributeError: '_Environ' object has no attribute 'data'