Skip to content

Commit

Permalink
#35: this should solve the issue in python2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenwh authored and akorosov committed Nov 9, 2020
1 parent 043e010 commit d15a49c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pythesint/cf_vocabulary.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,21 @@ def _fetch_online_data(self):
details = {}
metadata_details = node.getElementsByTagName('owl:Ontology')[0]
for detail in metadata_details.childNodes:
if type(detail)==xml.dom.minidom.Element:
# This does not work in python2.7 because type(detail)=instance
#if type(detail)==xml.dom.minidom.Element:
try:
details[detail.nodeName] = detail.childNodes[0].data
except (AttributeError, IndexError):
continue

cf_list = [details]
for cnode in node.getElementsByTagName('Standard_Name')[0].childNodes:
if type(cnode)==xml.dom.minidom.Element:
#if type(cnode)==xml.dom.minidom.Element:
try:
entry = cnode.getElementsByTagName('Standard_Name')[0]
except (AttributeError, IndexError):
continue
else:
standard_name = entry.getAttribute('rdf:about')
units = ''
if entry.getElementsByTagName('canonical_units'):
Expand Down

0 comments on commit d15a49c

Please # to comment.