@@ -148,26 +148,29 @@ def generate_lems_file_for_neuroml(
148148 shutil .copy (incl_curr , target_dir )
149149
150150 ls .include_neuroml2_file (include .href , include_included = False )
151- sub_doc = read_neuroml2_file (incl_curr )
152- sub_dir = (
153- os .path .dirname (incl_curr )
154- if len (os .path .dirname (incl_curr )) > 0
155- else "."
156- )
157-
158- if sub_doc .__class__ == neuroml .nml .nml .NeuroMLDocument :
159- for include in sub_doc .includes :
160- incl_curr = "%s/%s" % (sub_dir , include .href )
161- logger .info (
162- " -- Including %s located at %s" % (include .href , incl_curr )
163- )
151+ try :
152+ sub_doc = read_neuroml2_file (incl_curr )
153+ sub_dir = (
154+ os .path .dirname (incl_curr )
155+ if len (os .path .dirname (incl_curr )) > 0
156+ else "."
157+ )
158+
159+ if sub_doc .__class__ == neuroml .nml .nml .NeuroMLDocument :
160+ for include in sub_doc .includes :
161+ incl_curr = "%s/%s" % (sub_dir , include .href )
162+ logger .info (
163+ " -- Including %s located at %s" % (include .href , incl_curr )
164+ )
164165
165- if not os .path .isfile (
166- "%s/%s" % (target_dir , os .path .basename (incl_curr ))
167- ) and not os .path .isfile ("%s/%s" % (target_dir , incl_curr )):
166+ if not os .path .isfile (
167+ "%s/%s" % (target_dir , os .path .basename (incl_curr ))
168+ ) and not os .path .isfile ("%s/%s" % (target_dir , incl_curr )):
168169
169- shutil .copy (incl_curr , target_dir )
170- ls .include_neuroml2_file (include .href , include_included = False )
170+ shutil .copy (incl_curr , target_dir )
171+ ls .include_neuroml2_file (include .href , include_included = False )
172+ except TypeError :
173+ logging .info ("File: %s is not a NeuroML file, but it may be LEMS, ignoring..." % incl_curr )
171174
172175 if (
173176 gen_plots_for_all_v
0 commit comments