krassowski / jupyter-manim

manim cell magic for IPython/Jupyter to show the output video
MIT License
194 stars 11 forks source link

AttributeError: can't set attribute #15

Closed qo4on closed 4 years ago

qo4on commented 4 years ago

I see an error in line image = ImageMobject("/content/manim/Pol/1.png"). The same code works perfectly with command line !python3 -m manim example.py mainScene -r 1080,1920.

/tmp/tmpl8hjzawx.py:15: UserWarning: Import from notebook: name already in the globals(), skipping
  warn('Import from notebook: ' + name + ' already in the globals(), skipping')
Traceback (most recent call last):
  File "/content/manim/manimlib/extract_scene.py", line 155, in main
    scene = SceneClass(**scene_kwargs)
  File "/content/manim/manimlib/scene/scene.py", line 53, in __init__
    self.construct()
  File "/tmp/tmpl8hjzawx.py", line 34, in construct
    image = ImageMobject("/content/manim/Pol/1.png")
  File "/content/manim/manimlib/mobject/types/image_mobject.py", line 56, in __init__
    image = Image.open(path).convert(self.image_mode)
  File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 2804, in open
    init()
  File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 2790, in _open_core
  File "/usr/local/lib/python3.6/dist-packages/PIL/ImageFile.py", line 102, in __init__
    self._open()
  File "/usr/local/lib/python3.6/dist-packages/PIL/PngImagePlugin.py", line 579, in _open
    self.size = self.png.im_size
AttributeError: can't set attribute
krassowski commented 4 years ago

I would need a full reproducible example to investigate.

qo4on commented 4 years ago

I found the issue. jupyter-manim stops working after environment restart in colab. You can try to call Text object after the restart and you'll get undefined.