3b1b / 3b1b/videos

xml.etree.ElementTree.ParseError: syntax error: line 1, column 0 (and temporary solution)

Aperta Adatta ai principianti
#107 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
11.2k
Fork
2.1k
Merge medio
5h 49m
PR unite (30g)
3

Descrizione

I have this error using Fedora 40, python3.11 and python3.12 when using LaTeX:

```
File "/home/zavden/Manim/mgl_test/manimlib/mobject/svg/svg_mobject.py", line 128, in mobjects_from_svg_string
element_tree = ET.ElementTree(ET.fromstring(svg_string))
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/xml/etree/ElementTree.py", line 1335, in XML
parser.feed(text)
xml.etree.ElementTree.ParseError: syntax error: line 1, column 0
```

In svg_mobject.py, line 128 I printed the variable "svg_string", and I noticed that this message was printed before the xml:

```
The old, written in PostScript, PDF interpreter has been removed entirely.
You should cease using -dNEWDPF as it has no effect n
```

I don't know how to solve it directly using ET, so I solved it by removing that text manually (line 127):

```py
def mobjects_from_svg_string(self, svg_string: str) -> list[VMobject]:
header_in_xml = svg_string.find("

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Il problema si trova in manimlib/mobject/svg/svg_mobject.py alla riga 128. Il svg_string contiene un messaggio di avviso prima dell'intestazione XML. La soluzione temporanea trova l'inizio '

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
xml
Ambito
backend
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
65/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.