From 86480e58eafc1fa3486e03155ed34e02b4595a24 Mon Sep 17 00:00:00 2001 From: Slávek Banko Date: Sun, 22 Jan 2023 02:02:13 +0100 Subject: Drop python2 support in scripts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py') diff --git a/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py b/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py index d38771fc8..7d308ab2d 100755 --- a/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py +++ b/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py @@ -18,7 +18,7 @@ import os, sys try: from TQt import qt except (ImportError): - raise "Failed to import the required PyTQt python module." + raise Exception("Failed to import the required PyTQt python module.") class Dialog(tqt.QDialog): def __init__(self, scriptpath, parent): @@ -69,7 +69,7 @@ class Dialog(tqt.QDialog): stylebox.setSpacing(6) stylelabel = qt.TQLabel("Style:",stylebox) self.stylecombo = qt.TQComboBox(stylebox) - stylenames = self.styles.keys() + stylenames = list(self.styles.keys()) stylenames.sort() for stylename in stylenames: self.stylecombo.insertItem(stylename) @@ -123,12 +123,13 @@ class Dialog(tqt.QDialog): sheetname = str( self.sheetcombo.currentText() ) sheet = self.doc.sheetByName( sheetname ) - print "sheetname=%s sheet=%s" % (sheetname,sheet) + print("sheetname=%s sheet=%s" % (sheetname,sheet)) filename = str( self.fileedit.text() ) try: file = open(filename, "w") - except IOError, (errno, strerror): + except IOError as xxx_todo_changeme: + (errno, strerror) = xxx_todo_changeme.args qt.TQMessageBox.critical(self,"Error","Failed to create HTML file \"%s\"

%s
" % (filename,strerror)) return -- cgit v1.2.3