3b1b / manim

Animation engine for explanatory math videos
MIT License
71.22k stars 6.25k forks source link

Division By Zero on creation.py running ExampleScene.py #1350

Open Chubek opened 3 years ago

Chubek commented 3 years ago

Good day. I'm getting Division By Zero running ExampleScene.py on Windows. Here's the error:

This is METAFONT, Version 2.7182818 (MiKTeX 21.1)

(C:\Program Files\MiKTeX\fonts/source/public/rsfs\rsfs10.mf
(C:\Program Files\MiKTeX\fonts/source/public/cm\cmbase.mf)
(C:\Program Files\MiKTeX\fonts/source/public/rsfs\script.mf
(C:\Program Files\MiKTeX\fonts/source/public/rsfs\scriptu.mf [65] [66] [67]
[68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81] [82]
[83] [84] [85] [86] [87] [88] [89] [90] [127]) ) )
Font metrics written on rsfs10.tfm.
Output written on rsfs10.600gf (27 characters, 9120 bytes).
Transcript written on rsfs10.log.
This is METAFONT, Version 2.7182818 (MiKTeX 21.1)

(C:\Program Files\MiKTeX\fonts/source/public/rsfs\rsfs7.mf
(C:\Program Files\MiKTeX\fonts/source/public/cm\cmbase.mf)
(C:\Program Files\MiKTeX\fonts/source/public/rsfs\script.mf
(C:\Program Files\MiKTeX\fonts/source/public/rsfs\scriptu.mf [65] [66] [67]
[68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81] [82]
[83] [84] [85] [86] [87] [88] [89] [90] [127]) ) )
Font metrics written on rsfs7.tfm.
Output written on rsfs7.600gf (27 characters, 6624 bytes).
Transcript written on rsfs7.log.
This is METAFONT, Version 2.7182818 (MiKTeX 21.1)

(C:\Program Files\MiKTeX\fonts/source/public/rsfs\rsfs5.mf
(C:\Program Files\MiKTeX\fonts/source/public/cm\cmbase.mf)
(C:\Program Files\MiKTeX\fonts/source/public/rsfs\script.mf
(C:\Program Files\MiKTeX\fonts/source/public/rsfs\scriptu.mf [65] [66] [67]
[68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81] [82]
[83] [84] [85] [86] [87] [88] [89] [90] [127]) ) )
Font metrics written on rsfs5.tfm.
Output written on rsfs5.600gf (27 characters, 4704 bytes).
Transcript written on rsfs5.log.
I:\manic\manimlib\mobject\svg\svg_mobject.py:132: UserWarning: g1-84 not recognized
  warnings.warn(f"{ref} not recognized")
I:\manic\manimlib\mobject\svg\svg_mobject.py:132: UserWarning: g1-104 not recognized
  warnings.warn(f"{ref} not recognized")
I:\manic\manimlib\mobject\svg\svg_mobject.py:132: UserWarning: g1-105 not recognized
  warnings.warn(f"{ref} not recognized")
I:\manic\manimlib\mobject\svg\svg_mobject.py:132: UserWarning: g1-115 not recognized
  warnings.warn(f"{ref} not recognized")
I:\manic\manimlib\mobject\svg\svg_mobject.py:132: UserWarning: g1-111 not recognized
  warnings.warn(f"{ref} not recognized")
I:\manic\manimlib\mobject\svg\svg_mobject.py:132: UserWarning: g1-109 not recognized
  warnings.warn(f"{ref} not recognized")
I:\manic\manimlib\mobject\svg\svg_mobject.py:132: UserWarning: g1-101 not recognized
  warnings.warn(f"{ref} not recognized")
I:\manic\manimlib\mobject\svg\svg_mobject.py:132: UserWarning: g1-76 not recognized
  warnings.warn(f"{ref} not recognized")
I:\manic\manimlib\mobject\svg\svg_mobject.py:132: UserWarning: g0-65 not recognized
  warnings.warn(f"{ref} not recognized")
I:\manic\manimlib\mobject\svg\svg_mobject.py:132: UserWarning: g1-69 not recognized
  warnings.warn(f"{ref} not recognized")
I:\manic\manimlib\mobject\svg\svg_mobject.py:132: UserWarning: g1-88 not recognized
  warnings.warn(f"{ref} not recognized")
Traceback (most recent call last):
  File "manim.py", line 5, in <module>
    manimlib.main()
  File "I:\manic\manimlib\__init__.py", line 12, in main
    scene.run()
  File "I:\manic\manimlib\scene\scene.py", line 75, in run
    self.construct()
  File "example_scenes.py", line 20, in construct
    Write(title),
  File "I:\manic\manimlib\animation\creation.py", line 134, in __init__
    self.set_default_config_from_length(mobject)
  File "I:\manic\manimlib\animation\creation.py", line 145, in set_default_config_from_length
    self.lag_ratio = min(4.0 / length, 0.2)
ZeroDivisionError: float division by zero

MikiTex, FFmpeg.

Thanks!

CarsonWV commented 3 years ago

I experienced this issue yesterday when I installed Manim for the first time. I worked around it by replacing Line 145 of my local copy of manim\manimlib\animation\creation.py

self.lag_ratio = min(4.0 / length, 0.2)

with

try:
     self.lag_ratio = min(4.0 / length, 0.2)
except:
     self.lag_ratio = 0.2

Though it allowed me to run the example scene, I have no idea of the long-term implications of this change. I'd appreciate any amount of help from an experienced user.