I also had this error. It turns out that Sen2Cor’s approach to picking up the metadata XML file within the product .SAFE folder is not particularly clever, so if you have any other XML files in there besides the {product}.xml file then it might pick the wrong one up. Delete any additional XML files in the {product}.SAFE folder, such as those generated by QGIS if you have previously opened/exported the L1C data, then run the script again.