question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dvisvgm cannot create svg files in the default temporary storage folder on Windows

See original GitHub issue

Describe 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:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
mgiesekicommented, Feb 8, 2021

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.

0reactions
TonyCranecommented, Feb 8, 2021

Sorry. That’s my fault.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Frequently Asked Questions - dvisvgm
dvisvgm creates empty SVG graphics when converting PDF files. Why is that? ... As of Ghostscript 9.56.0 the new PDF interpreter is activated...
Read more >
Cannot create temporary folder - Microsoft Community
This has installed perfectly on my Windows 8.1 PC but today, when I try to access it, I get an error message: Cannot...
Read more >
Temporary Storage in R | Jonathan Trattner
A brief blog post on how to use temporary files to write data, read and manipulate it, and then delete the original file...
Read more >
How To Change Temporary Files Location in Windows
How to change the location of your temporary files and folders in Windows 7, Windows 8 & 8.1, and Windows 10. This will...
Read more >
B.3.3.5 Where MySQL Stores Temporary Files
If none of TMPDIR , TEMP , or TMP are set, MySQL uses the Windows system default, which is usually C:\windows\temp\ . If...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found