Rpush magic doesn't find local variables and doesn't support comma separated lists of variables #2550

rmcgibbo opened this Issue Nov 6, 2012 · 3 comments

2 participants


1) The %Rpush line magic function in the rmagic extension doesn't support variables with local scope. For example, the code below does not work. function1() works, but function2() does not.

%load_ext rmagic
def function1():
    local_var = "this gets printed"
    %R -i local_var local_var = local_var
    %R print(local_var)

def function2():
    local_var = "this doesn't print"
    %Rpush local_var
    %R print(local_var)


To view the error, see http://nbviewer.ipython.org/4027617/

2) %Rpush doesn't let you push a bunch of local variables that are separated by commas. For example, the following code throws a KeyError.

%load_ext rmagic
x, y = 1,2
%Rpush x, y

The code only works if the third line is %Rpush x y


It should be pretty easy to accomplish both of these changes by mimicking existing code in %%R.

Do you want to give it a shot?


Yeah, I'm working on it right now.

@rmcgibbo rmcgibbo added a commit to rmcgibbo/ipython that referenced this issue Nov 6, 2012
@rmcgibbo rmcgibbo Fixed rmagic/RPush issue #2550 32b56cd
@rmcgibbo rmcgibbo added a commit to rmcgibbo/ipython that referenced this issue Dec 18, 2012
@rmcgibbo rmcgibbo Fix issue #2550 76097b6
@bfroehle bfroehle added a commit to bfroehle/ipython that referenced this issue Jan 2, 2013
@rmcgibbo rmcgibbo Fix issue #2550 3632cfb

The first issue was fixed in #2731 and I've created a separate issue to track the second bug #2733.

@bfroehle bfroehle closed this Jan 2, 2013
@minrk minrk added a commit to minrk/ipython that referenced this issue Jan 26, 2013
@rmcgibbo rmcgibbo Fix issue #2550 e8f24c3
@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
@rmcgibbo rmcgibbo Fix issue #2550 6425b0b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment