@@ -320,14 +320,16 @@ def log_internal_cpp_errors(
320320
321321 chr_offset_re = re .compile (r"at offset (\d+)\s*" )
322322 for_instance_re = re .compile (r"\s*for instance #(\d+)\s*" )
323+ for_header_ent_re = re .compile (r"\s*for header entity (\w+)" )
323324
324325 if log_content is None :
325326 log_content = ifcopenshell .get_log ()
326327 msgs = list (map (json .loads , filter (None , log_content .split ("\n " ))))
327328 chr_offsets = [chr_offset_re .findall (m ["message" ]) for m in msgs ]
328329 instance_messages = [for_instance_re .findall (m ["message" ]) for m in msgs ]
330+ header_messages = [for_header_ent_re .findall (m ["message" ]) for m in msgs ]
329331
330- if chr_offsets or (instance_messages and f is None ):
332+ if any ( chr_offsets ) or (any ( instance_messages ) and f is None ):
331333 # The file is opened in binary mode, in order
332334 # to correspond with the offsets reported by
333335 # IfcOpenShell C++
@@ -348,7 +350,7 @@ def log_internal_cpp_errors(
348350 else :
349351 logger .error ("For instance:\n %s\n %s" , line , m )
350352
351- if instance_messages :
353+ if any ( instance_messages ) :
352354 for instid , msg in zip (instance_messages , msgs ):
353355 if instid :
354356 m = for_instance_re .sub ("" , msg ["message" ])
@@ -376,6 +378,12 @@ def log_internal_cpp_errors(
376378 else :
377379 logger .error (m )
378380
381+ if any (header_messages ):
382+ for hent , msg in zip (header_messages , msgs ):
383+ if hent :
384+ m = msg ["message" ]
385+ logger .error (m )
386+
379387
380388entity_attribute_map : dict [tuple [str , str ], tuple [entity_type , tuple [attribute , ...]]] = {}
381389
0 commit comments