# tests / unwrap
reEncodedHeader = re.compile(self.XMP_HEADER_PATTERN.encode(self.encoding))
m = reEncodedHeader.match(packet)
- assert m is not None, "No xmp header found"
- xmp = packet[m.end():]
+ if m is None :
+ console.warn('XMP packet wrapper not found')
+ self.xmp = packet
+ return
+ xmp = packet[m.end():]
trailer = self.XMP_TRAILER[:-6].encode(self.encoding) # TODO handle read-only mode
trailerPos = xmp.find(trailer)
assert trailerPos != -1, "No xmp trailer found"