Swagatam Sengupta
Swagatam Sengupta

Reputation: 57

TypeError: unbound method parse() must be called with ElementTree instance as first argument (got str instance instead)

I am trying to edit an xml file. But on executing the below mentioned code it is showing an error "TypeError: unbound method parse() must be called with ElementTree instance as first argument (got str instance instead)". I have a deadline coming up, Any help will be appreciated

from xml.etree.ElementTree import ElementTree as ET

tree = ET.parse('lolo.xml')

Upvotes: 1

Views: 617

Answers (1)

Daniel Haley
Daniel Haley

Reputation: 52858

Adding comment as answer...

Try changing your import to import xml.etree.ElementTree as ET

Upvotes: 1

Related Questions