File not found error

19 views
Skip to first unread message

Ingo Dahn

unread,
Sep 24, 2021, 6:32:41 AM9/24/21
to sage-cell
I converted a notebook with Python 3 kernel, which executed well in CoCalc, into a web page with SageCells with language python.
In the converted page, executing the first cell after the heading "Main Program" throws a FileNotFound error when it attempts to load a file from GitHub. Downloading the file in  Chrome from that URL works. (The URL is set in the first cell after the heading "Data Load Function".)
Note: As linked Sagecells cannot be automatically executed, all cells before this cell have to be executed before to reproduce the error.
Another (minor) error, which did not occur in CoCalc is, that print throws an error reporting a premature end of line when the string to be printed conatins \n.

David Farmer

unread,
Sep 24, 2021, 7:19:39 AM9/24/21
to sage-cell

A cell cannot download an arbitrary file from the Web.

Is that what the code is trying to do?

On Fri, 24 Sep 2021, Ingo Dahn wrote:

> I converted a notebook with Python 3 kernel, which executed well in CoCalc, into a web page with SageCells with
> language python.In the converted page, executing the first cell after the heading "Main Program" throws a
> FileNotFound error when it attempts to load a file from GitHub. Downloading the file in  Chrome from that URL
> works. (The URL is set in the first cell after the heading "Data Load Function".)
> Note: As linked Sagecells cannot be automatically executed, all cells before this cell have to be executed
> before to reproduce the error.
> Another (minor) error, which did not occur in CoCalc is, that print throws an error reporting a premature end
> of line when the string to be printed conatins \n.
>
> --
> You received this message because you are subscribed to the Google Groups "sage-cell" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> sage-cell+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cell/7c74a16a-7905-4085-bcff-cfcc9f1737f9n%40googlegroups.com.
>
>

Ingo Dahn

unread,
Sep 24, 2021, 10:07:45 AM9/24/21
to sage-cell
No, the cells load files from Github, which is whitelisted a.f.a.I.k.

Ingo Dahn

unread,
Sep 24, 2021, 1:47:14 PM9/24/21
to sage-cell
I could solve the main problem - gzip.open doesn't support URLs.
The minor problem, that print on sagecell doesn't accept \n in string to be printed, still is open. From the Python 3 documentation I read that print("\na\n") should be ok, but it gives an error in sagecell.

Andrey Novoseltsev

unread,
Sep 24, 2021, 4:42:00 PM9/24/21
to sage-cell
Thank you for tracking it down! Something is off with encoding when we pass such a command to Python via exec, I'll take a look.

Andrey Novoseltsev

unread,
Sep 27, 2021, 12:04:40 PM9/27/21
to sage-cell
Hi Ingo!

This should take care of newlines:
Can you please check how it works for you? I am surprised that we didn't hit this issue before in so many years...

Thank you for reporting!
Andrey

Ingo Dahn

unread,
Sep 27, 2021, 12:12:33 PM9/27/21
to sage-cell
Yes, at https://sagecell.sagemath.org/ it works fine. Thanks for correcting. I don't use \n in strings myself, but found this in a third party notebook on machine learning which I converted..
Reply all
Reply to author
Forward
0 new messages