[issue41759] ElementTree.parse gives error message about missing1 required positional argument: 'source' but it is there

Freek de Kruijf report at bugs.python.org
Fri Sep 11 08:13:42 EDT 2020


Freek de Kruijf <f.de.kruijf at gmail.com> added the comment:

Op vrijdag 11 september 2020 11:31:29 CEST schreef u:
> Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
> 
> parse() is an instance method. It should be called as tree.parse(f) (where
> tree is an instance of ElementTree), not ElementTree.parse(f).
> 
> ----------
I have no idea how to make tree an instance.
Reading the documentation,
https://docs.python.org/2/library/xml.etree.elementtree.html,
it shows as an example:

import xml.etree.ElementTree as ET
tree = ET.parse('country_data.xml')

which is exactly what the program looks like and what my small python script 
does without an error.

-- 
fr.gr.

Freek de Kruijf

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41759>
_______________________________________


More information about the Python-bugs-list mailing list