dvisvgm cannot create svg files in the default temporary storage folder on Windows
See original GitHub issueDescribe the bug
When I run a scene that contains Tex
and do not make changes to custom_defaults.yml
, an OSError
will be thrown, indicating that the svg file cannot be found.
OSError: C:\Users\Me\Temp\Tex\1b70addfb3f4902b.svg not Found
It may be because my current running directory is in the D:
drive, and the system default temporary folder is in the C:
drive. And dvisvgm cannot run across disks.
And when I set temporary_storage
in custom_defaults.yml
to a folder in D:
drive, it can run normally
Code:
class TestTemp(Scene):
def construct(self):
tex = Tex("abc")
self.add(tex)
Wrong display or Error traceback:
Traceback
Traceback (most recent call last):
File "manim.py", line 5, in <module>
manimlib.main()
File "D:\Users\Me\Desktop\manim\manim_shaders\manimlib\__init__.py", line 12, in main
scene.run()
File "D:\Users\Me\Desktop\manim\manim_shaders\manimlib\scene\scene.py", line 76, in run
self.construct()
File "test.py", line 5, in construct
tex = Tex("abc")
File "D:\Users\Me\Desktop\manim\manim_shaders\manimlib\mobject\svg\tex_mobject.py", line 167, in __init__
super().__init__(full_string, **kwargs)
File "D:\Users\Me\Desktop\manim\manim_shaders\manimlib\mobject\svg\tex_mobject.py", line 48, in __init__
"should_remove_null_curves": True,
File "D:\Users\Me\Desktop\manim\manim_shaders\manimlib\mobject\svg\svg_mobject.py", line 55, in __init__
self.file_path = get_full_vector_image_path(file_name)
File "D:\Users\Me\Desktop\manim\manim_shaders\manimlib\utils\images.py", line 21, in get_full_vector_image_path
extensions=[".svg", ".xdv"],
File "D:\Users\Me\Desktop\manim\manim_shaders\manimlib\utils\file_ops.py", line 48, in find_file
raise IOError(f"{file_name} not Found")
OSError: C:\Users\Me\AppData\Local\Temp\Tex\1b70addfb3f4902b.svg not Found
Additional context
dvisvgm version: 2.6.3
If I set the output level of dvisvgm to the highest level in tex_file_writing.py
and output the executed command, I will see:
dvisvgm "C:\Users\Me\AppData\Local\Temp\Tex\1b70addfb3f4902b.dvi" -n -v 7 -o "C:\Users\Me\AppData\Local\Temp\Tex\1b70addfb3f4902b.svg" > nul
pre-processing DVI file (format version 2)
processing page 1
computing extents based on data set by preview package (version 11.91)
width=13.905134pt, height=6.944447pt, depth=0pt
graphic size: 13.905134pt x 6.944447pt (4.887096mm x 2.440694mm)
WARNING: failed to write output to C:../../../AppData/Local/Temp/Tex/1b70addfb3f4902b.svg
1 of 1 page converted in 1.398 seconds
Note that even if the output file is specified in the command as "C:\Users\Me\AppData\Local\Temp\Tex\1b70addfb3f4902b.svg"
(absolute path). But dvisvgm still wants to use a relative path, and the currently running path is under D:
drive, so dvisvgm specifies the disk to C:
and sets the output location to "C:../../../AppData/Local/Temp/Tex/1b70addfb3f4902b.svg"
, which of course will cause errors.
So facing this problem, we should try to solve the problem of dvisvgm (I think it will be more difficult), or change a default temporary storage folder for Windows instead of using the system default tempfile.gettempdir()
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
I just stumbled over this ticket. The issue probably stems from the old dvisvgm version 2.6.3. It should be fixed since version 2.8.
Sorry. That’s my fault.