Code doesn't work after importing another package

66 Views Asked by At

I'm currently working in PyCharm version 11.0.11 with Python 3.9, and I'm using Manim Community version 0.17.3.

In my project, the only library I had imported was Manim:

from manim import *

The code was working and then I added another library:

from manimlib.imports import *

It broke my code. After removing that line, my code still didn't work, and I received the error message:

   There are no scenes inside that module

It also isn't the code, when I create a new project and import (only) manim there everything works again.

My Questions:

  • How is it even possible for a package to mess with my code, eventhough I don't have it imported? Did it overwrite something from the first package?
  • How can I remove that one package that causes troubles from my Pycharm-project entirerly, I have tried to "Optimize Imports" but that didn't help.

Since requested I'd like to show an example, this is my code that is working perfectly:

from manim import *

class test(Scene):
    def construct(self):
        equation = MathTex(r"A=B")
        self.play(FadeIn(equation))
        self.wait(1)

I'm always calling it by typing this into my Pycharm-terminal:

 manim -p -ql main.py test

Now I'm changing nothing except adding the new line:

from manim import *
from manimlib.imports import *

class test(Scene):
    def construct(self):
        equation = MathTex(r"A=B")
        self.play(FadeIn(equation))
        self.wait(1)

After installing the package to my pycharm-project, the code doesn't compile anymore and gives the error:

Traceback (most recent call last):
  File "c:\users\xxxx\pycharmprojects\manimbugtest\venv\lib\site-packages\manimlib\extract_scene.py", line 155, in main
    scene = SceneClass(**scene_kwargs)
  File "c:\users\xxxx\pycharmprojects\manimbugtest\venv\lib\site-packages\manimlib\scene\scene.py", line 75, in __init__
    self.construct()
  File "main.py", line 7, in construct
    self.play(FadeIn(equation))
  File "c:\users\xxxx\pycharmprojects\manimbugtest\venv\lib\site-packages\manimlib\animation\transform.py", line 27, in __init__
    super().__init__(mobject, **kwargs)
  File "c:\users\xxxx\pycharmprojects\manimbugtest\venv\lib\site-packages\manimlib\animation\animation.py", line 31, in __init__
    assert(isinstance(mobject, Mobject))
AssertionError

After removeing that line from the code, one would expect that the code is working again, but by calling it I get:

PS C:\Users\xxxx\PycharmProjects\manimbugtest> manim -p -ql main.py test
Media will be written to C:\Users\xxxx\PycharmProjects\manimbugtest\media\. You can change this behavior with the --media_dir flag.

   There are no scenes inside that module

0

There are 0 best solutions below