Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing variables to script from the workspace #3928

Closed
amelio-vazquez-reina opened this issue Aug 7, 2013 · 1 comment
Closed

Passing variables to script from the workspace #3928

amelio-vazquez-reina opened this issue Aug 7, 2013 · 1 comment
Milestone

Comments

@amelio-vazquez-reina
Copy link

Say I define several variables in an IPython session:

In [4]:   a = 3
...
In [6]: c= 10 

And say I have a Python file called foo.py

with the following contents:

print "Hello", a
print  "World", c

Whenever I try

In [10]: run foo.py

I get undefined a

because the script is not receiving the variables in the workspace. How can I pass these variables to the script without changing the script?

@minrk
Copy link
Member

minrk commented Aug 7, 2013

run starts in a clean namespace by default. You want %run -i foo.py.

@minrk minrk closed this as completed Aug 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants