From: Benoît Pin Date: Thu, 14 Nov 2013 20:05:53 +0000 (+0100) Subject: Le « XMP packet wrapper » est optionnel. On ôte l’assertion qui la voulait coûte... X-Git-Url: https://scm.cri.ensmp.fr/git/Photo.git/commitdiff_plain/09e934d7c2e0f27e729899f9e06c3674a89f4703?hp=2e218c7ef43c2e1a880999a98a220e37268a62bd Le « XMP packet wrapper » est optionnel. On ôte l’assertion qui la voulait coûte que coûte. --- diff --git a/xmp.py b/xmp.py index 2270eeb..8738e50 100755 --- a/xmp.py +++ b/xmp.py @@ -72,9 +72,12 @@ class XMP(object) : # 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"