diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py index a7a9fabe0a6..63cbde38b0b 100644 --- a/src/sage/interfaces/gap.py +++ b/src/sage/interfaces/gap.py @@ -514,8 +514,8 @@ def load_package(self, pkg, verbose=False): RuntimeError: Error loading Gap package chevie. You may want to install gap_packages SPKG. """ if verbose: - print("Loading GAP package {}" % pkg) - x = self.eval('LoadPackage("%s")'%pkg) + print("Loading GAP package {}".format(pkg)) + x = self.eval('LoadPackage("{}")'.format(pkg)) if x == 'fail': raise RuntimeError("Error loading Gap package "+str(pkg)+". "+ "You may want to install gap_packages SPKG.") diff --git a/src/sage/interfaces/gap3.py b/src/sage/interfaces/gap3.py index a10e150665a..f941708d5e4 100644 --- a/src/sage/interfaces/gap3.py +++ b/src/sage/interfaces/gap3.py @@ -231,6 +231,8 @@ from sage.misc.cachefunc import cached_method from sage.interfaces.expect import Expect from sage.interfaces.gap import Gap_generic, GapElement_generic +from sage.cpython.string import bytes_to_str + # gap3_cmd should point to the gap3 executable gap3_cmd = 'gap3' @@ -415,7 +417,8 @@ def _execute_line(self, line, wait_for_prompt=True, expect_eof=False): # detect it. So we test for a syntax error explicitly. normal_output, error_output = \ super(Gap3, self)._execute_line(line, wait_for_prompt=True, expect_eof=False) - if normal_output.startswith("Syntax error:"): + normal = bytes_to_str(normal_output) + if normal.startswith("Syntax error:"): normal_output, error_output = "", normal_output return (normal_output, error_output)