Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
some py3 fixes for gap and gap3
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Jun 4, 2019
1 parent 716fb69 commit 40b137c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/sage/interfaces/gap.py
Expand Up @@ -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.")
Expand Down
5 changes: 4 additions & 1 deletion src/sage/interfaces/gap3.py
Expand Up @@ -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'
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 40b137c

Please sign in to comment.