3b1b / 3b1b/manim

AssertionError when attempting to use SVGMobject

Aperta
#1,668 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Python
Stelle
93.8k
Fork
7.7k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

### Describe the bug
Hi, I'm trying to insert a SVG file using the SVGMobject(), but I keep getting the same AssertionError.
I've tried to use different SVG files, but all of them have the same result.
I've put both regular imager(jpeg, png) and vector images(svg) in the same folder (".../my_manim_project/manim/images/")
I tried running ImageTest also which works fine for a regular jpeg, so the file path that I'm using should work fine.

**Code**:
main.py:
```sh
from manimlib import *

class VectorImageTest(Scene):
def construct(self):
self.play(FadeIn(SVGMobject("OverarmRight-Left.svg")))
#Also tried:
#self.play(DrawBorderThenFill(SVGMobject("OverarmRight-Left"), rate_func=linear))
self.wait()
# Vector image will be read by SVGMobject

class ImageTest(Scene):
def construct(self):
img = ImageMobject("Me.jpg")
self.wait()
self.play(FadeIn(img))
self.wait()
```
default_config.yml:
```sh
directories:
# Set this to true if you want the path to video files
# to match the directory structure of the path to the
# sourcecode generating that video
mirror_module_path: False
# Where should manim output video and image files?
output: ""
# If you want to use images, manim will look to these folders to find them
raster_images: "/Users/gjerm/PycharmProjects/my_manim_project/manim/images/"
vector_images: "/Users/gjerm/PycharmProjects/my_manim_project/manim/images/"
# If you want to use sounds, manim will look here to find it.
sounds: ""
# Manim often generates tex_files or other kinds of serialized data
# to keep from having to generate the same thing too many times. By
# default, these will be stored at tempfile.gettempdir(), e.g. this might
# return whatever is at to the TMPDIR environment variable. If you want to
# specify them elsewhere,
temporary_storage: ""
.
.
.

```
**Wrong display or Error traceback**:
```sh
PS C:\Users\gjerm\PycharmProjects\my_manim_project\manim> manimgl main.py Sample -f
ManimGL v1.2.0
[14:44:53] INFO Using the default configuration file, which you can modify in config.py:231
`c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\default_config.yml`
INFO If you want to create a local configuration file, you can create a file named `custom_config.yml`, or run `manimgl config.py:232
--config`
WARNING You may be using Windows platform and have not specified the path of `temporary_storage`, which may cause OSError. config.py:200
So it is recommended to specify the `temporary_storage` in the config file (.yml)
Traceback (most recent call last):
File "C:\Users\gjerm\OneDrive\Dokumenter\my_manim_project\Scripts\manimgl-script.py", line 33, in
sys.exit(load_entry_point('manimgl', 'console_scripts', 'manimgl')())
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\__main__.py", line 25, in main
scene.run()
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\scene\scene.py", line 76, in run
self.construct()
File "main.py", line 15, in construct
self.play(FadeIn(SVGMobject("manim-logo-sidebar.svg")))
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\svg\svg_mobject.py", line 59, in __init__
super().__init__(**kwargs)
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\types\vectorized_mobject.py", line 76, in __init__
super().__init__(**kwargs)
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\mobject.py", line 75, in __init__
self.init_points()
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\svg\svg_mobject.py", line 75, in init_points
mobjects = self.get_mobjects_from(svg)
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\svg\svg_mobject.py", line 91, in get_mobjects_from
result += it.chain(*(
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\svg\svg_mobject.py", line 92, in
self.get_mobjects_from(child)
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\svg\svg_mobject.py", line 91, in get_mobjects_from
result += it.chain(*(
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\svg\svg_mobject.py", line 92, in
self.get_mobjects_from(child)
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\svg\svg_mobject.py", line 91, in get_mobjects_from
result += it.chain(*(
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\svg\svg_mobject.py", line 92, in
self.get_mobjects_from(child)
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\svg\svg_mobject.py", line 96, in get_mobjects_from
result.append(self.path_string_to_mobject(
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\svg\svg_mobject.py", line 125, in path_string_to_mobject
return VMobjectFromSVGPathstring(
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\svg\svg_mobject.py", line 332, in __init__
super().__init__(**kwargs)
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\types\vectorized_mobject.py", line 76, in __init__
super().__init__(**kwargs)
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\mobject.py", line 75, in __init__
self.init_points()
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\svg\svg_mobject.py", line 348, in init_points
self.handle_commands()
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\svg\svg_mobject.py", line 399, in handle_commands
func(*args)
File "c:\users\gjerm\pycharmprojects\my_manim_project\manim\manimlib\mobject\types\vectorized_mobject.py", line 315, in start_new_path
assert(self.get_num_points() % self.n_points_per_curve == 0)
AssertionError
```

### Additional context
I'm running my Code on Windows 10(21H1), using the Terminal in the Pycharm IDE(Version 2021.2.3 Community Edition).

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.