3b1b / manim

Animation engine for explanatory math videos
MIT License
69.94k stars 6.16k forks source link

Running code in quick start has error: FileNotFoundError: [Errno 2] No such file or directory: '' #2099

Open Fireond opened 8 months ago

Fireond commented 8 months ago

Describe the error

For code in quick start:

from manimlib import *

class SquareToCircle(Scene):
    def construct(self):
        circle = Circle()
        circle.set_fill(BLUE, opacity=0.5)
        circle.set_stroke(BLUE_E, width=4)
        square = Square()

        self.play(ShowCreation(square))
        self.wait()
        self.play(ReplacementTransform(square, circle))
        self.wait()

When running

manimgl start.py SquareToCircle -o

It reports error

❯ manimgl start.py SquareToCircle -o

ManimGL v1.6.1
[12:35:34] INFO     Using the default configuration file,     config.py:362
                    which you can modify in                                
                    `/Users/hanyu_yan/Documents/Codes/py/mani              
                    m/manimlib/default_config.yml`                         
           INFO     If you want to create a local             config.py:363
                    configuration file, you can create a file              
                    named `custom_config.yml`, or run                      
                    `manimgl --config`                                     
Traceback (most recent call last):
  File "/Users/hanyu_yan/anaconda3/envs/manim/bin/manimgl", line 8, in <module>
    sys.exit(main())
  File "/Users/hanyu_yan/Documents/Codes/py/manim/manimlib/__main__.py", line 22, in main
    scenes = manimlib.extract_scene.main(config)
  File "/Users/hanyu_yan/Documents/Codes/py/manim/manimlib/extract_scene.py", line 134, in main
    scenes = get_scenes_to_render(all_scene_classes, scene_config, config)
  File "/Users/hanyu_yan/Documents/Codes/py/manim/manimlib/extract_scene.py", line 107, in get_scenes_to_render
    return [
  File "/Users/hanyu_yan/Documents/Codes/py/manim/manimlib/extract_scene.py", line 108, in <listcomp>
    scene_from_class(scene_class, scene_config, config)
  File "/Users/hanyu_yan/Documents/Codes/py/manim/manimlib/extract_scene.py", line 86, in scene_from_class
    return scene_class(**scene_config)
  File "/Users/hanyu_yan/Documents/Codes/py/manim/manimlib/scene/scene.py", line 122, in __init__
    self.file_writer = SceneFileWriter(self, **self.file_writer_config)
  File "/Users/hanyu_yan/Documents/Codes/py/manim/manimlib/scene/scene_file_writer.py", line 81, in __init__
    self.init_output_directories()
  File "/Users/hanyu_yan/Documents/Codes/py/manim/manimlib/scene/scene_file_writer.py", line 96, in init_output_directories
    movie_dir = guarantee_existence(out_dir)
  File "/Users/hanyu_yan/Documents/Codes/py/manim/manimlib/utils/file_ops.py", line 24, in guarantee_existence
    os.makedirs(path)
  File "/Users/hanyu_yan/anaconda3/envs/manim/lib/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: ''

But it work well with

manimgl start.py SquareToCircle -os

Environment

OS System: macOS Ventura Version 13.6.3 (22G436) manim version: master python version: 3.8.18

foxypiratecove37350 commented 8 months ago

It's because in manimlib/default_config.yml you didn't set output, so by default it's "". You can set it to a relative path like videos/.