One of the issues is that code in Sage is using this temporary directory in 
the background; the user is not doing it and has no control over it. 
Regardless of the context manager approach, apparently some browsers refuse 
to open local files that are not in the user's home directory, so this 
location just won't work for them.


On Tuesday, September 27, 2022 at 2:22:47 AM UTC-7 dim...@gmail.com wrote:

> On Tue, Sep 27, 2022 at 3:58 AM Andrey Novoseltsev <novo...@gmail.com> 
> wrote:
> >
> > Hello!
> >
> > I've run into this while testing upgrades to Ubuntu 22.04 from 20.04, 
> but it seems that it comes from how temporary files are handled in Sage 9.7:
> >
> > TMP_DIR_FILENAME_BASE=tempfile.TemporaryDirectory()
> >
> > this temporary directory is created and then used ever after. But what 
> if it gets deleted?
> I think it's meant to be used in a context manager, i.e. with with
> statement, e.g., citing python docs:
>
> >>> with tempfile.TemporaryDirectory() as tmpdirname:
> ... print('created temporary directory', tmpdirname)
> >>>
> # directory and contents have been removed
>
> Or with a callback (from Sage source)
>
> TMP_DIR_FILENAME_BASE=tempfile.TemporaryDirectory()
> atexit.register(lambda: TMP_DIR_FILENAME_BASE.cleanup())
>
>
> Needless to say, one can interfere with it in a bad way messing around
> with ~/.sage/ - but so it the case for any file-based process...
>
>
>
> For example, what if someone uses tmpreaper or something similar,
> when old files are removed from /tmp? Sage does not notice it, but
> things break in a weird way, e.g. plots are not displayed and the
> error message is not transparent.
> >
> > I believe this is exactly what is happening and I would appreciate some 
> attention to this matter ;-)
> >
> > Thank you!
> > Andrey
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sage-devel+...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/5ee63ec7-26b2-4c32-a5a7-45fb63a11327n%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/bcfa5eaa-600b-4752-8b52-189422564a49n%40googlegroups.com.

Reply via email to