First time here? Check out the FAQ!

Ask Your Question
1

How to load .sobj files into Jupyter Notebook

asked 4 years ago

elcardin gravatar image

updated 4 years ago

slelievre gravatar image

Hello! I am medium-new with Sage, and I'm trying to figure out how best to load a list across notebooks. I want to keep one notebook up and computing further entries of a list, while saving what I have so far so that I can use it in other codes. However, I can't figure out how to load .sobj files.

When I'm in a notebook, I save my file by save(list,'list') and I see list.sobj in my Jupyter Home directory. But I can't figure out how to load it into another notebook. I've tried load('list.sobj') and various iterations of load('C:\Users\myusername\list.sobj')but it keep getting the same error:

'(list.sobj)' was not found in history, as a file, url, nor in the user namespace.

What am I missing?

Preview: (hide)

Comments

Does this work in terminal? (i.e. at sage: prompt)

Dima gravatar imageDima ( 4 years ago )

I don't know, I didn't try it in the terminal.

elcardin gravatar imageelcardin ( 3 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 3 years ago

elcardin gravatar image

I believe the issue was with where the file was saving. I'm not sure why I couldn't just direct to where it was saving by default, but the issue is solved when I specify where to save the file, and then call the same address, i.e.,

save(roots,'\\users\\myusername\\list.sobj')

and

list=load('\\users\\myusername\\list.sobj')
Preview: (hide)
link

Comments

Using raw strings avoids having to escape backslashes.

Instead of '\\users\\myusername\\list.sobj' one can write r'\users\myusername\list.sobj'.

slelievre gravatar imageslelievre ( 3 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 4 years ago

Seen: 1,067 times

Last updated: Apr 10 '21