ipython/ipython — pull request #2737 by rmcgibbo (2013-01-02 22:57:58+00:00)
Title: Rmagic: error message when moving an non-existant variable from python to R

Currently, when you try to push a non-existant python variable to R, you get a `KeyError`
```
In [1]: %load_ext rmagic
In [2]: %Rpush sdf

[... traceback ...]

KeyError: u'sdf'
```
Maybe the error message could be more intuitive? The fact that local variables are stored in a dict (thus generating a `KeyError`) is kind-of an implementation detail.

In regular python, using an undefined variable name generates a `NameError` -- perhaps that would also be the appropriate error to raise in this case?

This PR changes the error to:
```
In [1]: %load_ext rmagic
In [2]: %Rpush sdf

[... traceback ...]

NameError: name 'sdf' is not defined
```