Ask Your Question
1

How to load .sobj files into Jupyter Notebook

asked 2021-03-23 06:00:29 +0200

elcardin gravatar image

updated 2021-03-23 12:17:06 +0200

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?

edit retag flag offensive close merge delete

Comments

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

Dima gravatar imageDima ( 2021-03-24 12:35:38 +0200 )edit

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

elcardin gravatar imageelcardin ( 2021-04-10 03:23:50 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-04-10 03:26:03 +0200

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')
edit flag offensive delete link more

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 ( 2021-04-13 01:21:07 +0200 )edit

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: 2021-03-23 06:00:29 +0200

Seen: 52 times

Last updated: Apr 10