Skip to content
Advertisement

Manim exception in text mobject example

I’m trying to run this example from Manim community documentation:

from manim import *

class HelloWorld(Scene):
    def construct(self):
        text = Text('Hello world').scale(3)
        self.add(text)

For some reason I’m getting this error:

TypeError: __init__() got an unexpected keyword argument 'color'

I’m using the latest version of Manim community (0.14.0)

What am I doing wrong?

The full output is:

(Python3.9) C:UsersUserIdeaProjectsGraphConnectivityDemo>manim -pql scene.py HelloWorld            
Manim Community v0.14.0
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│                                                                                                  │
│ C:UsersUserPython3.9libsite-packagesmanimclirendercommands.py:139 in render             │
│                                                                                                  │
│   136 │   │   for SceneClass in scene_classes_from_file(file):                                   │
│   137 │   │   │   try:                                                                           │
│   138 │   │   │   │   scene = SceneClass()                                                       │
│ ❱ 139 │   │   │   │   scene.render()                                                             │
│   140 │   │   │   except Exception:                                                              │
│   141 │   │   │   │   error_console.print_exception()                                            │
│   142 │   │   │   │   sys.exit(1)                                                                │
│ C:UsersUserPython3.9libsite-packagesmanimscenescene.py:219 in render                     │
│                                                                                                  │
│    216 │   │   """                                                                               │
│    217 │   │   self.setup()                                                                      │
│    218 │   │   try:                                                                              │
│ ❱  219 │   │   │   self.construct()                                                              │
│    220 │   │   except EndSceneEarlyException:                                                    │
│    221 │   │   │   pass                                                                          │
│    222 │   │   except RerunSceneException as e:                                                  │
│                                                                                                  │
│ C:UsersUserIdeaProjectsGraphConnectivityDemoscene.py:5 in construct                         │
│                                                                                                  │
│   2                                                                                              │
│   3 class HelloWorld(Scene):                                                                     │
│   4 │   def construct(self):                                                                     │
│ ❱ 5 │   │   text = Text('Hello world').scale(3)                                                  │
│   6 │   │   self.add(text)                                                                       │
│   7                                                                                              │
│                                                                                                  │
│ C:UsersUserPython3.9libsite-packagesmanimmobjectsvgtext_mobject.py:472 in __init__      │
│                                                                                                  │
│    469 │   │   │   )                                                                             │
│    470 │   │   else:                                                                             │
│    471 │   │   │   self.line_spacing = self._font_size + self._font_size * self.line_spacing     │
│ ❱  472 │   │   file_name = self.text2svg()                                                       │
│    473 │   │   PangoUtils.remove_last_M(file_name)                                               │
│    474 │   │   super().__init__(                                                                 │
│    475 │   │   │   file_name,                                                                    │
│                                                                                                  │
│ C:UsersUserPython3.9libsite-packagesmanimmobjectsvgtext_mobject.py:753 in text2svg      │
│                                                                                                  │
│    750 │   │   if os.path.exists(file_name):                                                     │
│    751 │   │   │   svg_file = file_name                                                          │
│    752 │   │   else:                                                                             │
│ ❱  753 │   │   │   settings = self.text2settings()                                               │
│    754 │   │   │   width = config["pixel_width"]                                                 │
│    755 │   │   │   height = config["pixel_height"]                                               │
│    756                                                                                           │
│                                                                                                  │
│ C:UsersUserPython3.9libsite-packagesmanimmobjectsvgtext_mobject.py:714 in text2settings │
│                                                                                                  │
│    711 │   │   │   │   temp_settings.append(TextSetting(start, setting.start, **setting_args))   │
│    712 │   │   │   start = setting.end                                                           │
│    713 │   │   if start != len(self.text):                                                       │
│ ❱  714 │   │   │   temp_settings.append(TextSetting(start, len(self.text), **setting_args))      │
│    715 │   │   settings = sorted(temp_settings, key=lambda setting: setting.start)               │
│    716 │   │                                                                                     │
│    717 │   │   if re.search(r"n", self.text):                                                   │
│                                                                                                  │
│ C:UsersUserIdeaProjectsGraphConnectivityDemocmanimpango.pyx:9 in                            │
│ manimpango.cmanimpango.TextSetting.__init__                                                      │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ 'C:\Users\User\IdeaProjects\GraphConnectivityDemo\cmanimpango.pyx'                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: __init__() got an unexpected keyword argument 'color'

Advertisement

Answer

You could try to upgrade manimpango via pip install -U manimpango. As a workaround, using Tex instead would also work as long as you have LaTeX installed.

Advertisement