2626import logging
2727
2828from pathlib import Path
29- from collections import OrderedDict
3029import xmltodict
3130
3231logger = logging .getLogger ("knxproject" )
@@ -265,7 +264,7 @@ def _parse_knxproject(filename, password=None):
265264 top = ga_dict .get ('GroupRange' ,None )
266265 if top is None : return GAs
267266
268- if isinstance (top , OrderedDict ):
267+ if not isinstance (top , list ):
269268 # if there is only one child defined in xml, an ordered dict is
270269 # returned here instead of a list
271270 # so we need to convert it to a list
@@ -277,7 +276,7 @@ def _parse_knxproject(filename, password=None):
277276 middle_dict = middle .get ('GroupRange' ,None )
278277 if middle_dict is None : continue
279278
280- if isinstance ( middle_dict , OrderedDict ):
279+ if not isinstance ( middle_dict , list ):
281280 # same as above
282281 middle_ga = [middle_dict ]
283282 else :
@@ -288,7 +287,7 @@ def _parse_knxproject(filename, password=None):
288287
289288 if last_dict is None : continue
290289
291- if isinstance ( last_dict , OrderedDict ):
290+ if not isinstance ( last_dict , list ):
292291 # same as above
293292 last_ga = [last_dict ]
294293 else :
@@ -309,3 +308,5 @@ def _parse_knxproject(filename, password=None):
309308 except Exception as e :
310309 print ("Error {} occurred" .format (e ))
311310 return GAs
311+
312+
0 commit comments