New submission from Freek de Kruijf <f.de.kru...@gmail.com>:
In a function definition I have the following piece of code: try: with open(requests,'rt') as f: tree = ElementTree.parse(f) On execution I got: Traceback (most recent call last): File "/srv/www/bin/web.py", line 362, in <module> build_db() File "/srv/www/bin/web.py", line 58, in build_db db_builder.build_DB() File "/srv/www/bin/db_builder.py", line 190, in build_DB tree = ElementTree.parse(f) TypeError: parse() missing 1 required positional argument: 'source' There is an assignment for requests like requests = '..' + os.path.sep + "/etc/signatures.xml" This gives requests the value ..//etc/signatures.xml while the program runs in /srv/www/bin/ When I run the small python script like: import xml.etree.ElementTree as ElementTree with open('/srv/www/etc/signatures.xml','rt') as f: tree = ElementTree.parse(f) all is well. Apparently open(requests,'rt') does not raise an error. ---------- components: Extension Modules messages: 376706 nosy: f.de.kruijf priority: normal severity: normal status: open title: ElementTree.parse gives error message about missing1 required positional argument: 'source' but it is there type: behavior versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41759> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com