question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IndexError: list index out of range in text_mobject

See original GitHub issue

Windows 10, Python 3.8.5, latest Manim from master branch

from manimlib.imports import *


class test(Scene):
    def construct(self):
        t = r"""a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9 0 . : , ; ' " ( ! ? ) + - * / = ` ~ @ $ % ^ & [ ] { } _ \ | < >"""

        text = Text(t, font='Arial', stroke_width=0)

        self.add(text)
        self.wait(.1)

Traceback (most recent call last):
  File "C:\manim\manimlib\extract_scene.py", line 155, in main
    scene = SceneClass(**scene_kwargs)
  File "C:\manim\manimlib\scene\scene.py", line 75, in __init__
    self.construct()
  File "C:\test.py", line 8, in construct
    text = Text(t, font='Arial', stroke_width=0)
  File "C:\manim\manimlib\mobject\svg\text_mobject.py", line 67, in __init__
    self.apply_space_chars()
  File "C:\manim\manimlib\mobject\svg\text_mobject.py", line 162, in apply_space_chars
    space.move_to(self.submobjects[char_index - 1].get_center())
IndexError: list index out of range

Whereas these lines work fine:

        text = Text(t[2:], font='Arial', stroke_width=0)
        text = Text(t[:-2], font='Arial', stroke_width=0)

It looks like SVGMobject cannot handle symbols like < and >. Any Ideas how to fix that?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
chenyuluecommented, Dec 28, 2020

@naveen521kk Thanks for your work!

1reaction
behacklcommented, Sep 24, 2020

I used it in 3b1b master. I also tested it with shader Manim. Does community Manim have shader version?

No, we don’t have something similar for now.

I think I have identified the issue and it should be solved via #476.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IndexError: list index out of range in text_mobject · Issue #1234
Windows 10, Python 3.8.5, latest Manim from master branch from manimlib.imports import * class test(Scene): def construct(self): t ...
Read more >
I keep getting “IndexError: list index out of range” when trying ...
This error basically means you are trying to access a value at a List index which is out of bounds i.e greater than...
Read more >
Index error: list index out of range - How to skip a broken URL?
Every time I run this, it will stop whenever it encounters a URL that doesn't exist and gives the error: index error: list...
Read more >
Indexerror: list Index Out of Range in Python - STechies
In python “list index out of range” error occurs when we try to access an undefined element from the list. List index out...
Read more >
Python IndexError: List Index Out of Range [Easy Fix] - Finxter
To solve the “IndexError: list index out of range”, avoid do not access a non-existing list index. For example, my_list[5] causes an error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found