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

IndexError: index -3 is out of bounds for axis 0 with size 0 #1991

Closed
Xycharm opened this issue Feb 8, 2023 · 3 comments
Closed

IndexError: index -3 is out of bounds for axis 0 with size 0 #1991

Xycharm opened this issue Feb 8, 2023 · 3 comments

Comments

@Xycharm
Copy link

Xycharm commented Feb 8, 2023

Describe the error

I followed the instruction in 3b1b/manim and installed manim, but when I tried it out(use the command below), it seems that something in index went wrong.

#Try it out
manimgl example_scenes.py OpeningManimExample

Code and Error

Code:

manimgl example_scenes.py OpeningManimExample

Error:

C:\Users\Xy191\AppData\Roaming\Python\Python310\site-packages\pyglet\libs\win32\__init__.py:285: UserWarning: Could not set COM MTA mode. Unexpected behavior may occur.
  warnings.warn("Could not set COM MTA mode. Unexpected behavior may occur.")
ManimGL v1.6.1
[10:58:31] INFO     Using the default configuration file, which you can modify in                          config.py:362
                    `c:\users\xy191\desktop\github\manim\manimlib\default_config.yml`
           INFO     If you want to create a local configuration file, you can create a file named          config.py:363
                    `custom_config.yml`, or run `manimgl --config`
           WARNING  You may be using Windows platform and have not specified the path of                   config.py:327
                    `temporary_storage`, which may cause OSError. So it is recommended to specify the
                    `temporary_storage` in the config file (.yml)
           WARNING  You may be using Windows platform and have not specified the path of                   config.py:327
                    `temporary_storage`, which may cause OSError. So it is recommended to specify the
                    `temporary_storage` in the config file (.yml)
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Xy191\AppData\Roaming\Python\Python310\Scripts\manimgl.exe\__main__.py", line 7, in <module>
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\__main__.py", line 25, in main
    scene.run()
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\scene\scene.py", line 160, in run
    self.construct()
  File "C:\Users\Xy191\Desktop\GitHub\manim\example_scenes.py", line 14, in construct
    intro_words = Text("""
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\svg\text_mobject.py", line 425, in __init__
    super().__init__(
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\svg\text_mobject.py", line 130, in __init__
    super().__init__(text, height=height, **kwargs)
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\svg\string_mobject.py", line 68, in __init__
    super().__init__(
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\svg\svg_mobject.py", line 76, in __init__
    self.init_svg_mobject()
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\svg\svg_mobject.py", line 105, in init_svg_mobject
    submobs = self.mobjects_from_file(self.get_file_path())
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\svg\string_mobject.py", line 115, in mobjects_from_file
    submobs = super().mobjects_from_file(file_path)
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\svg\svg_mobject.py", line 133, in mobjects_from_file
    return self.mobjects_from_svg(svg)
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\svg\svg_mobject.py", line 188, in mobjects_from_svg
    mob = self.path_to_mobject(shape)
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\svg\svg_mobject.py", line 241, in path_to_mobject
    return VMobjectFromSVGPath(path, **self.path_string_config)
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\svg\svg_mobject.py", line 303, in __init__
    super().__init__(**kwargs)
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\types\vectorized_mobject.py", line 122, in __init__
    super().__init__(**kwargs)
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\mobject.py", line 115, in __init__
    self.init_points()
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\svg\svg_mobject.py", line 311, in init_points
    self.handle_commands()
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\svg\svg_mobject.py", line 338, in handle_commands
    if self.has_new_path_started():
  File "C:\Users\Xy191\Desktop\GitHub\manim\manimlib\mobject\types\vectorized_mobject.py", line 549, in has_new_path_started
    return self.consider_points_equal(points[-3], points[-2])
IndexError: index -3 is out of bounds for axis 0 with size 0 

Environment

OS System: Windows 11 Pro
manim version: master
python version:3.10

@Varniex
Copy link
Contributor

Varniex commented Feb 8, 2023

@3b1b, this error occurred in my case too. To resolve this issue, I added the following lines in vectorized_mobject.py at line 549

if len(points) == 0:
    return False

I'm not sure if this is the right way to do that. But, it seemed to resolve the error. Is there any other way to resolve it?

@TonyCrane
Copy link
Collaborator

I don't have this error. Maybe there is something wrong with Text svg generating on your machine?

@3b1b
Copy link
Owner

3b1b commented Feb 8, 2023

@3b1b, this error occurred in my case too. To resolve this issue, I added the following lines in vectorized_mobject.py at line 549

if len(points) == 0:
    return False

I'm not sure if this is the right way to do that. But, it seemed to resolved the error. Is there any other way to resolve it?

That looks like the right way to resolve it to me.

3b1b added a commit that referenced this issue Feb 8, 2023
@3b1b 3b1b closed this as completed Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants