I've been using this script (Merge multiple XML files from command line) to combine xml files on Debian Jessie. I'm in the process of moving to a dedicated server running CENTOS 6.6 x86_64. I'm having issues getting the script to work in the new environment. Any Help would be appreciated.
python version 2.7
THE SCRIPT
#!/usr/bin/env python
import sys
from xml.etree import ElementTree
def run(files):
first = None
for filename in files:
data = ElementTree.parse(filename).getroot()
if first is None:
first = data
else:
first.extend(data)
if first is not None:
print ElementTree.tostring(first)
if __name__ == "__main__":
run(sys.argv[1:])
THE ERRORS
0+0 records in
0+0 records out
0 bytes (0 B) copied, 9.8139e-05 s, 0.0 kB/s
0+0 records in
0+0 records out
0 bytes (0 B) copied, 7.7816e-05 s, 0.0 kB/s
0+0 records in
0+0 records out
0 bytes (0 B) copied, 7.3015e-05 s, 0.0 kB/s
0+0 records in
0+0 records out
0 bytes (0 B) copied, 7.1727e-05 s, 0.0 kB/s
0+0 records in
0+0 records out
0 bytes (0 B) copied, 7.6014e-05 s, 0.0 kB/s
0+0 records in
0+0 records out
0 bytes (0 B) copied, 8.1163e-05 s, 0.0 kB/s
Traceback (most recent call last):
File "/location/private/xmlcombine.py", line 17, in <module>
run(sys.argv[1:])
File "/location/private/xmlcombine.py", line 12, in run
first.extend(data)
AttributeError: _ElementInterface instance has no attribute 'extend'
Traceback (most recent call last):
File "/location/private/xmlcombine.py", line 17, in <module>
run(sys.argv[1:])
File "/location/private/xmlcombine.py", line 12, in run
first.extend(data)
AttributeError: _ElementInterface instance has no attribute 'extend'
Traceback (most recent call last):
File "/location/private/xmlcombine.py", line 17, in <module>
run(sys.argv[1:])
File "/location/private/xmlcombine.py", line 12, in run
first.extend(data)
AttributeError: _ElementInterface instance has no attribute 'extend'
Process Completed