I am parsing xml files on a linux ubuntu machine using a python script and the cElementTree package. After a while (at the same point every time) it results in the error
Segmentation fault (core dumped)
This seems to be a C error and hence I think its connected to the C-library I am using (cElementTree). However, I am a bit stuck in how to debug this. If I run the same program on my local Macbook, it works fine without any problem. Only on the linux server does it crash? How can I debug this? Does anybody know about problems of cElementTree in linux?
Here is my code
import xml.etree.cElementTree as ET
def fill_pubmed_papers_table(list_of_files):
for f in list_of_files:
print "read file %s" % f
inF = gzip.open(f, 'rb')
tree = ET.parse(inF)
inF.close()
root = tree.getroot()
papers = root.findall('PubmedArticle')
root.clear()
for i, citation in enumerate(papers):
write_to_db(citation)
return
the parsing script write_to_db() is fairly long, but I can make it available if anybody is interested.