Python kodundaki hata nedir?

grant

Decapat
Katılım
23 Nisan 2022
Mesajlar
680
Çözümler
1
Daha fazla  
Sistem Özellikleri
Rx 550 4GB | i3 10100f | 8GB DDR4 3200Mhz ram | MSI H510M-A PRO
Cinsiyet
Erkek
Meslek
Yazılım
Python:
import json
import xmltodict
with open("catalog.xml") as xml_dosyasi:
    islenmis_veri = xmltodict.parse(xml_dosyasi.read())
    xml_dosyasi.close()

    json_donusturucu = json.dumps(islenmis_veri)

    with open("json_cikti.json","w") as json_dosyasi:
        json_dosyasi.write(json_donusturucu)
        json_dosyasi.close()

Hata:
Kod:
Traceback (most recent call last):
  File "C:\Users\buğra\PycharmProjects\pythonProject\main.py", line 4, in <module>
    islenmis_veri = xmltodict.parse(xml_dosyasi.read())
  File "C:\Users\buğra\AppData\Local\Programs\Python\Python310\lib\site-packages\xmltodict.py", line 378, in parse
    parser.Parse(xml_input, True)
xml.parsers.expat.ExpatError: syntax error: line 1, column 0
 
Son düzenleyen: Moderatör:
Python:
import json.
import xmltodict.
with open("catalog.xml") as xml_dosyasi:
 islenmis_veri = xmltodict.parse(xml_dosyasi.read())
 xml_dosyasi.close()

 json_donusturucu = json.dumps(islenmis_veri)

 with open("json_cikti.json","w") as json_dosyasi:
 json_dosyasi.write(json_donusturucu)
 json_dosyasi.close()

Hata:
Kod:
Traceback (most recent call last):
 File "C:\Users\buğra\PycharmProjects\pythonProject\main.py", line 4, in <module>
 islenmis_veri = xmltodict.parse(xml_dosyasi.read())
 File "C:\Users\buğra\AppData\Local\Programs\Python\Python310\lib\site-packages\xmltodict.py", line 378, in parse.
 parser.Parse(xml_input, True)
xml.parsers.expat.ExpatError: syntax error: line 1, column 0

Yazım hatası yapmışsın ama tam olarak nerede çözemedim.
 

Dosya Ekleri

  • hata1.PNG
    hata1.PNG
    61,5 KB · Görüntüleme: 24
Hata mesajından yola çıkarsak okuduğun xml dosyasında bir sözdizimi hatası var gibi, bir kontrol et.
Yazdığım kodlar da mı hata var? Yoksa catalog.xml in içinde bir hata olma ihtimali var mı?
 

Yeni konular

Geri
Yukarı