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

Default video directory "" triggers an error. #2261

Closed
jeertmans opened this issue Dec 10, 2024 · 0 comments · Fixed by #2277
Closed

Default video directory "" triggers an error. #2261

jeertmans opened this issue Dec 10, 2024 · 0 comments · Fixed by #2277
Labels

Comments

@jeertmans
Copy link

Describe the bug

Hello, I have found a bug that affects ManimGL >= 1.7 (5927f6a)

If you don't specify the video directory, it defaults to "" (see code snippet),
which raises an error (see below).

out_dir = self.output_directory or ""

Code:

Does not matter, but option --write_file or --save_last_frame must be used, otherwise the faulty line is not executed.

Wrong display or Error traceback:

ManimGL v1.7.1
Traceback (most recent call last):
  File "/home/jeertmans/repositories/manim-slides/.venv/bin/manimgl", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/jeertmans/repositories/manim-slides/.venv/lib/python3.11/site-packages/manimlib/__main__.py", line 22, in main
    scenes = manimlib.extract_scene.main(config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jeertmans/repositories/manim-slides/.venv/lib/python3.11/site-packages/manimlib/extract_scene.py", line 134, in main
    scenes = get_scenes_to_render(all_scene_classes, scene_config, config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jeertmans/repositories/manim-slides/.venv/lib/python3.11/site-packages/manimlib/extract_scene.py", line 107, in get_scenes_to_render
    return [
           ^
  File "/home/jeertmans/repositories/manim-slides/.venv/lib/python3.11/site-packages/manimlib/extract_scene.py", line 108, in <listcomp>
    scene_from_class(scene_class, scene_config, config)
  File "/home/jeertmans/repositories/manim-slides/.venv/lib/python3.11/site-packages/manimlib/extract_scene.py", line 86, in scene_from_class
    return scene_class(**scene_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jeertmans/repositories/manim-slides/manim_slides/slide/manimlib.py", line 18, in __init__
    super().__init__(*args, **kwargs)
  File "/home/jeertmans/repositories/manim-slides/manim_slides/slide/base.py", line 43, in __init__
    super().__init__(*args, **kwargs)
  File "/home/jeertmans/repositories/manim-slides/.venv/lib/python3.11/site-packages/manimlib/scene/scene.py", line 125, in __init__
    self.file_writer = SceneFileWriter(self, **self.file_writer_config)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jeertmans/repositories/manim-slides/.venv/lib/python3.11/site-packages/manimlib/scene/scene_file_writer.py", line 82, in __init__
    self.init_output_directories()
  File "/home/jeertmans/repositories/manim-slides/.venv/lib/python3.11/site-packages/manimlib/scene/scene_file_writer.py", line 97, in init_output_directories
    movie_dir = guarantee_existence(out_dir)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jeertmans/repositories/manim-slides/.venv/lib/python3.11/site-packages/manimlib/utils/file_ops.py", line 24, in guarantee_existence
    os.makedirs(path)
  File "<frozen os>", line 225, in makedirs
FileNotFoundError: [Errno 2] No such file or directory: ''

Additional context

On Linux, at least, the "" path doesn't refer to any valid path. If current working direction was meant, "." should be used.

@jeertmans jeertmans added the bug label Dec 10, 2024
jeertmans added a commit to jeertmans/manim-slides that referenced this issue Dec 10, 2024
jeertmans added a commit to jeertmans/manim-slides that referenced this issue Dec 11, 2024
* chore(deps): bump ManimGL to 1.7.1

Bump ManimGL's minimal version, so relax constraints on other deps and remove compatibility issues with Manim

* fix(docs): correct PR number

* fix(lib): update ManimGL's init

See 3b1b/manim#2261

* fix(lib): force float

* chore(tests): correctly ignore warning

* fix(tests)

* fix(tests): add skips

* chore(fmt): auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix(tests)

* oops

* fix on 3.12

* fix(lib): correctly patch ManimGL

* fix(deps): pyrr issue

* fix: version

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
3b1b added a commit that referenced this issue Dec 12, 2024
@3b1b 3b1b mentioned this issue Dec 13, 2024
3b1b added a commit that referenced this issue Dec 13, 2024
* Comment tweak

* Directly print traceback

Since the shell.showtraceback is giving some issues

* Make InteracrtiveSceneEmbed into a class

This way it can keep track of it's internal shell; use of get_ipython has a finicky relationship with reloading.

* Move remaining checkpoint_paste logic into scene_embed.py

This involved making a few context managers for Scene: temp_record, temp_skip, temp_progress_bar, which seem useful in and of themselves.

* Change null key to be the empty string

* Ensure temporary svg paths for Text are deleted

* Remove unused dict_ops.py functions

* Remove break_into_partial_movies from file_writer configuration

* Rewrite guarantee_existence using Path

* Clean up SceneFileWriter

It had a number of vestigial functions no longer used, and some setup that could be made more organized.

* Remove --save_pngs CLI arg (which did nothing)

* Add --subdivide CLI arg

* Remove add_extension_if_not_present

* Remove get_sorted_integer_files

* Have find_file return Path

* Minor clean up

* Clean up num_tex_symbols

* Fix find_file

* Minor cleanup for extract_scene.py

* Add preview_frame_while_skipping option to scene config

* Use shell.showtraceback function

* Move keybindings to config, instead of in-place constants

* Replace DEGREES -> DEG

* Add arg to clear the cache

* Separate out full_tex_to_svg from tex_to_svg

And only cache to disk the results of full_tex_to_svg.  Otherwise, making edits to the tex_templates would not show up without clearing the cache.

* Bug fix in handling BlankScene

* Make checkpoint_states an instance variable of CheckpointManager

As per #2272

* Move resizing out of Window.focus, and into Window.init_for_scene

* Make default output directory "." instead of ""

To address #2261

* Remove input_file_path arg from SceneFileWriter

* Use Dict syntax in place of dict for config more consistently across config.py

* Simplify get_output_directory

* Swap order of preamble and additional preamble
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant