Sen2Cor 2.4.0: KeyError on MimeType lookup

Sen2Cor 2.4.0 produces an exception on a couple, but not most, Sentinel-2 products when it is trying to assemble the output manifest. It looks like it is trying to generate an entry for a malformed filename, as the function throwing the error is the mime-type determiner. The stacktrace is below, and I’m attaching the full output and the report XML. The product it failed on was S2A_MSIL2C_20170218T110111_N0204_R094_T30SVG_20170218T110125.SAFE.

A colleague of mine reported that they;re urn the file successfuly through Sen2Cor 2.3.1, but unfortunately I don’t have an installation I can test that on in more detail.

Traceback (most recent call last):
  File "/opt/sen2cor/lib/python2.7/site-packages/sen2cor/", line 355, in <module>
  File "/opt/sen2cor/lib/python2.7/site-packages/sen2cor/", line 333, in main
    mn.generate(config.L2A_UP_DIR, config.L2A_MANIFEST_SAFE)
  File "/opt/sen2cor/lib/python2.7/site-packages/sen2cor/", line 352, in generate
    self.addDataObject(dataObjectSection, filepath, ids[filepath], l2productpath)
  File "/opt/sen2cor/lib/python2.7/site-packages/sen2cor/", line 224, in addDataObject
    byteStream.attrib["mimeType"] = self.getMimeType(href)
  File "/opt/sen2cor/lib/python2.7/site-packages/sen2cor/", line 200, in getMimeType
    return dicoMimeType[href.split(".")[-1]]
KeyError: 'jrctf0'

What’s confusing me is that I’ve searched the input and output SAFE archives and can’t find the string jrctf0, but also can’t see where Sen2cor could be generating it.

Incidentally, the Python standard library provides robust mimetype lookup functions in the mimetypes module. Why does Sen2Cor have its own lookup for this?

S2A_MSIL2A_20170218T110111_N0204_R094_T30SVG_20170218T110125_20171122T140718_report.xml (162.9 KB)

Output.txt.log (15.1 KB)