Sage's `gap_console()`

running ina terminal (in fact, emacs's `sage-mode`

...), youtr code works ; it fails in `Sagecell`

.

According to what I understand from the error message in`sagecell`

output, `sagecell`

pastes the lines together and adds continuation backslashes "when it feels it".

This behaviour is probably a bug, and a ticket should be filed as such. The "right place" may be `sagecell`

's issues page or Sage's Trac. Yelping on sage-support may get you a better direction.

**EDIT :** According to a `sage-devel`

thread, this problem is inherent to the `pexpect`

Gap interface. The author of this remark says :

I won't want to touch GAP's pexpect interface...

and wraps code in a Gap function that he defines and calls once.

An analogous possible workaround :

```
foo = """
LoadPackage("qpa");
Q:=Quiver(3,[[1,2,"a"],[2,3,"b"]]);
KQ:=PathAlgebra(GF(3),Q);
AssignGeneratorVariables(KQ);
rel:=[a*b];
A:=KQ/rel;
"""
Res=[]
for u in foo.splitlines() : Res.append(gap.eval(u))
Res
```

prints :

```
['',
'true',
'<quiver with 3 vertices and 2 arrows>',
'<GF(3)[<quiver with 3 vertices and 2 arrows>]>',
'',
'[ (Z(3)^0)*a*b ]',
'<GF(3)[<quiver with 3 vertices and 2 arrows>]/\n<two-sided ideal in <GF(3)[<quiver with 3 vertices and 2 arrows>]>, \n (1 generators)>>']
```

HTH,