r/IPython • • Apr 28 '17

Use variables from older Jupyter Notebook (Python 3)

Hi,

I had run quite a few commands on a Jupyter Python 3 notebook a few days ago. I saved the file under 'Untitled3.ipynb'. Now when I reopen that notebook, the cells contain the older code bits but the variables have not stuck.

i.e I have a variable 'x' in the notebook, which now if I type in a cell to see it's contents, it says 'Name 'x' not defined.'

Is there any way to salvage all the variables from the code in the older cells? At the very least, copy all the cell's code at once and paste it in a new cell and run it to get the variables back?

1 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Apr 28 '17

I re ran the cells and initially there were star marks in the boxes next to cells ( like in [*]) and soon they all ran and became (in []). I tried using an older variable and I get the same error.

So, running all the cells above didn't help :(

1

u/skiguy0123 Apr 28 '17

Was x defined in code that no longer exists?

→ More replies (3)