Can we read local file from Sagecell
Can we read local file from Sagecell? I work with SageMathCell embedded on blog.
Can we read local file from Sagecell? I work with SageMathCell embedded on blog.
No, you can not read a local file from Sagecell. Sagecell is like any webserver, imagine the security hole if an arbitrary webserver you connect to with a webbrowser could read any file on your hard disk ! If you want to let Sagecell access some file, you have to serve it publically, this works well, see the answer of your other question.
Yes, you can:
with open("/path/filename", 'r') as fin:
print fin.read()
This is a way to read local files into a SageMath notebook on your own computer, but it won't work on SageMathCell: https://sagecell.sagemath.org/
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2017-10-27 16:01:43 +0100
Seen: 1,119 times
Last updated: Mar 05 '18
Problem installing sagecell server
Sage cell server - do I really need so many makeSagecell invocations?
Sagecell kwargs no longer works
Is anything special required to setup a moinmoin wiki server with sage cells?
Tiddlywiki and Sage Cell Server
Notebook environment ( cell width)
Get an error message when trying to install sage cell server
Hmm, that is a good question. I'd assume not unless you can read from the internet - some Sage functions allow URLs in them. But it wouldn't have access to your file system.
Thank you...