Ask Your Question
3

upload data file to notebook

asked 2012-01-18 03:56:53 +0100

Eugene gravatar image

updated 2012-01-18 12:13:33 +0100

kcrisman gravatar image

Hello!

I have a data file on my hard drive which I can open like:

open('/path/to/file')

in case of sage's server can access this file. But if the server is on the remote machine and there is no way to share a file between my machine and the server, can I somehow upload this file via web-interface to the sage notebook server and then open it and read it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
5

answered 2012-01-18 09:13:42 +0100

kcrisman gravatar image

Yes. From the "Help" link at the top of any worksheet:

Use the Data menu to upload images and other files, and create new files that can be shared between worksheets. The DATA variable contains the path to the data files. For example, to open a file in that directory, do "open(DATA+'filename')". If foo.sage is a Sage file that you uploaded, type "load foo.sage"; if foo.py is a Python file, you can import it by typing "import foo".

If you search sagenb.org/pub/ for things with this syntax you should find lots of examples.

Weirdly, it's not possible to access http://www.sagenb.org/help without being logged in, but you would think this would be useful. I can't even find it on the documentation; it seems to only be accessible via the notebook, though I may note have looked hard enough.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2012-01-18 03:56:53 +0100

Seen: 3,992 times

Last updated: Jun 13 '13