Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
TonyCrane opened this issue Feb 8, 2021 · 6 comments
Labels

Comments

@TonyCrane
Copy link
Collaborator

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().

@TonyCrane TonyCrane added the bug label Feb 8, 2021
@naveen521kk
Copy link
Contributor

Is there a bug report upstream(ie, https://github.com/mgieseki/dvisvgm/issues)?

@TonyCrane
Copy link
Collaborator Author

I have searched, but did not find a similar problem (maybe I missed it).
And for this problem, I think it's better to choose another temporary storage path for Windows by default instead of solving this dvisvgm problem.

@naveen521kk
Copy link
Contributor

This should be reported upstream because this is something upstream should handle IMO.

@mgieseki
Copy link

mgieseki commented 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.

@naveen521kk
Copy link
Contributor

How did you even get here 😄 ?

@TonyCrane have a mention of it in the docs and this can be closed.

@TonyCrane
Copy link
Collaborator Author

Sorry. That's my fault.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants