Open j-uschu opened 4 months ago
Hi Jens,
My apologies and thank you for bringing this up! I can reproduce the error and I will put out a new version with the fix.
The master branch here on github is stable, so I will go ahead and push out a new version. If you want to use master immediately, you can do
git clone git@github.com:ltrujello/Tikz-Python.git
cd Tikz-Python
pip install -e .
And that should be it. Using master, it appears to work in jupyter notebook.
I have also run into this error. It seems to be caused by the way how tempfile
create a temp dir:
After executing the above lines, python will steps into the __exit__()
method of TemporaryDirectory
, which removes the entire directory. The output pdf file lies in this directory will be destroyed and FileNotFoundError
is raised in Tikzpicture.show()
.
I requested a pull #3 which fixes this behaviour, and releases some other improvements. @ltrujello
Hi,
I would like to use the software in a jupyterlab notebook but get always the same error message:
FileNotFoundError Traceback (most recent call last) Cell In[15], line 7 5 arc_one = tikz.arc((3, 0), 0, 180, x_radius=3, y_radius=1.5, options="dashed") 6 arc_two = tikz.arc((-3, 0), 180, 360, x_radius=3, y_radius=1.5) ----> 7 tikz.show()
File ~\AppData\Local\anaconda3\lib\site-packages\tikzpy\tikz_environments\tikz_picture.py:142, in TikzPicture.show(self, quiet) 140 def show(self, quiet: bool = False) -> None: 141 """Compiles the Tikz code and displays the pdf to the user. Set quiet=True to shut up latexmk.""" --> 142 pdf_file = self.compile(quiet) 143 webbrowser.open_new(str(pdf_file.as_uri()))
File ~\AppData\Local\anaconda3\lib\site-packages\tikzpy\tikz_environments\tikz_picture.py:137, in TikzPicture.compile(self, quiet) 135 else: 136 moved_pdf_file = self.BASE_DIR / pdf_file.name --> 137 pdf_file.replace(moved_pdf_file) 138 return moved_pdf_file.resolve()
File ~\AppData\Local\anaconda3\lib\pathlib.py:1247, in Path.replace(self, target) 1237 def replace(self, target): 1238 """ 1239 Rename this path to the target path, overwriting if that path exists. 1240 (...) 1245 Returns the new Path instance pointing to the target path. 1246 """ -> 1247 self._accessor.replace(self, target) 1248 return self.class(target)
FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden: 'C:\Users\schultz\AppData\Local\Temp\tmp44zphmy9\tex_file.pdf' -> 'C:\Users\schultz\Desktop\tex_file.pdf'
Python version is 3.10.9 Latex and pdftex are working very well and I have all rights to save, delete and what ever on my computer. Do you have any idea what's going wrong? By the way, I tried it with Spyder5 to and get the same result.
Best regards,
Jens