Message376706
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. |
|
Date |
User |
Action |
Args |
2020-09-11 09:22:51 | f.de.kruijf | set | recipients:
+ f.de.kruijf |
2020-09-11 09:22:51 | f.de.kruijf | set | messageid: <1599816171.47.0.67185595118.issue41759@roundup.psfhosted.org> |
2020-09-11 09:22:51 | f.de.kruijf | link | issue41759 messages |
2020-09-11 09:22:51 | f.de.kruijf | create | |
|