149 mimetype if self.dataCheckBox.isChecked() else '', |
149 mimetype if self.dataCheckBox.isChecked() else '', |
150 ';charset=utf-8;base64,' if self.dataCheckBox.isChecked() |
150 ';charset=utf-8;base64,' if self.dataCheckBox.isChecked() |
151 else '', |
151 else '', |
152 base64.b64encode(open(filepath, "rb").read()).decode() |
152 base64.b64encode(open(filepath, "rb").read()).decode() |
153 ) |
153 ) |
154 except (IOError, OSError) as err: |
154 except OSError as err: |
155 E5MessageBox.critical( |
155 E5MessageBox.critical( |
156 self, |
156 self, |
157 self.tr("Data URI Encoder"), |
157 self.tr("Data URI Encoder"), |
158 self.tr( |
158 self.tr( |
159 """<p>The file <b>{0}</b> could not be read.</p>""" |
159 """<p>The file <b>{0}</b> could not be read.</p>""" |