I want to convert an XML file to CSV. However, I keep getting the error AttributeError: ‘NoneType’ object has no attribute ‘integer’.
xmlparse = Xet.parse('Apple Music Library.xml')
root = xmlparse.getroot()
for i in root:
Track_ID = i.find("Tack ID").integer
Name = i.find("Name").text
Artist = i.find("Artist").text
I’ve tried changing the data type to text but, no change.
2
The error seems to be a result of a simple typo in the line Track_ID = i.find("Tack ID").integer
because the error is resulting from the i.find() statement returning None
. I assume it should be "Track ID"
inside of i.find()
.
Final line should be Track_ID = i.find("Track ID").integer