Ask Your Question

Revision history [back]

SageTex - Initializing plots directory fails in external drive.

Hello,

MacOS 13.4.1 - TexLive 2023 - SageMath version 10.0, Release Date: 2023-05-20 │ │ Using Python 3.11.1.

When I run

% !TEX TS-program = sage
\documentclass{article}
\usepackage{sagetex}
\begin{document}

\begin{sagesilent}
 G = plot(sin(x),-pi,pi)
\end{sagesilent}
This is

\sageplot{G}

my plot
\end{document}

I have 3 different results for these two cases:

a) Whether the sage-plots-for-Untitled.tex directory exists or not.

b) whether the location is an external device or not.

If the directory does not exist (running for the first time or has been deleted), the result is as expected for both cases, where the files are on the internal or external hard drive.

If the directory already exists, the result is as expected if the files are on the internal hard drive.

If the files are on an external drive and the directory exists, sagetex fails with:

Processing Sage code for Untitled.tex...
Code block (line 7) begin...end
Initializing plots directory

**** Error in Sage code on line 12 of Untitled.tex! Traceback follows.
Traceback (most recent call last):
  File "/Volumes/TOSHIBA4T/teste/Untitled.sagetex.sage.py", line 19, in <module>
    _st_.plot(_sage_const_0 , format='notprovided', _p_=G)
  File "/private/var/tmp/sage-10.0-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sagetex.py", line 225, in plot
    self.initplot()
  File "/private/var/tmp/sage-10.0-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sagetex.py", line 107, in initplot
    shutil.rmtree(self.plotdir)
  File "/private/var/tmp/sage-10.0-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/shutil.py", line 732, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/private/var/tmp/sage-10.0-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/shutil.py", line 683, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/private/var/tmp/sage-10.0-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/shutil.py", line 681, in _rmtree_safe_fd
    os.unlink(entry.name, dir_fd=topfd)
FileNotFoundError: [Errno 2] No such file or directory: '._plot-0.pdf'

**** Running Sage on Untitled.sage failed! Fix Untitled.tex and try again.

Anyone else had these problem? Can you help me? Is this a VenturaOS Privacy & Security issue?

Thanks, Filipe