3b1b / manim

Animation engine for explanatory math videos
MIT License
67.95k stars 6.07k forks source link

NumberLine mobject crashes Manim #614

Open jaxtonw opened 5 years ago

jaxtonw commented 5 years ago

I have the following code in a .py file that I've noticed crashes Manim.

class NumberLine(Scene):
    def construct(self):
        text = TextMobject("This is test text.")
        numberline1 = NumberLine()
        self.add(numberline1)
        self.play(FadeIn(text))
        self.wait()

Manim crashes while trying to generate the NumberLine object. The error that I get is:

    filename = os.path.basename(self.input_file_path)
AttributeError: 'SceneFileWriter' object has no attribute 'input_file_path'

I run the following from the command line: python manim.py NumberLineAnimations.py NumberLine -p

I am using the newest version of Manim on Windows. As soon as numberline1 and self.add(numberline1) is commented out, the program produces "This is test text." I also am unable to run \old_projects\number_line_scene.py NumberLineScene as I get the same exact error message.

jaxtonw commented 5 years ago
Traceback (most recent call last):
  File "%LocationToManim%\manim\manimlib\extract_scene.py", line 150, in main
    scene = SceneClass(**scene_kwargs)
  File "%LocationToManim%\manim\manimlib\scene\scene.py", line 52, in __init__
    self.construct()
  File "NumberLineanimations.py", line 7, in construct
    numberline1 = NumberLine()
  File "%LocationToManim%\manim\manimlib\scene\scene.py", line 37, in __init__
    self, **self.file_writer_config,
  File "%LocationToManim%\manim\manimlib\scene\scene_file_writer.py", line 44, in __init__
    self.init_output_directories()
  File "%LocationToManim%\manim\manimlib\scene\scene_file_writer.py", line 49, in init_output_directories
    module_directory = self.output_directory or self.get_default_module_directory()
  File "%LocationToManim%\manim\manimlib\scene\scene_file_writer.py", line 95, in get_default_module_directory
    filename = os.path.basename(self.input_file_path)
AttributeError: 'SceneFileWriter' object has no attribute 'input_file_path'

This is the full console output when running NumberLine

eulertour commented 5 years ago

numberline1 = NumberLine() on line 7 is attempting to instantiate itself. Change the name of the Scene to anything other than NumberLine to get it working.

jaxtonw commented 5 years ago

@eulertour , thank you so much! That fixed the issue I was having with my own numberline scene. However, if I run old_projects\number_line_scene.py NumberLineScene, I get the following error regarding os.startfile(file_path)

  File "%LocationToManim%\manim\manimlib\extract_scene.py", line 151, in main

    open_file_if_needed(scene.file_writer, **config)
  File "%LocationToManim%\manim\manimlib\extract_scene.py", line 35, in open_file_if_needed
    os.startfile(file_path)
FileNotFoundError: [WinError 2] The system cannot find the file ‘%LocationToManim%\\manim\\media\\videos\\number_line_scene\\480p15\\NumberLineScene.mp4'
Kolloom commented 5 years ago

old projects are not expected to run on the current codebase. The usual recommendation is to checkout the git version that authored that particular project.