Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Gap Length error when Length not called

Running the code below gives me an error:

Sg = [];
G = gap.SmallGroup(12,3);
for g in G:
        Sg.append(g);
Sg;

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_4.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("U2cgPSBbXTsKRyA9IGdhcC5TbWFsbEdyb3VwKDEyLDMpOwpmb3IgZyBpbiBHOgogICAgICAgIFNnLmFwcGVuZChnKTsKU2c7"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>

  File "/private/var/folders/1p/k79gxccd5r538784rqx_15fh0000gt/T/tmpc0eEFP/___code___.py", line 5, in <module>
    for g in G:
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 642, in __iter__
    for i in range(1, len(self)+1):
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 1014, in __len__
    return int(self.Length())
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 588, in __call__
    return self._obj.parent().function_call(self._name, [self._obj] + list(args), kwds)
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 896, in function_call
    ['%s=%s'%(key,value.name()) for key, value in kwds.items()])))
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 570, in eval
    result = Expect.eval(self, input_line, **kwds)
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/expect.py", line 1224, in eval
    for L in code.split('\n') if L != ''])
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 769, in _eval_line
    raise RuntimeError(message)
RuntimeError: Gap produced error output
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `Length' on 1 arguments

   executing Length($sage3);

How can I fix this?

Gap Length error when Length not called

Running the code below gives me an error:

Sg = [];
G = gap.SmallGroup(12,3);
for g in G:
        Sg.append(g);
Sg;

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_4.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("U2cgPSBbXTsKRyA9IGdhcC5TbWFsbEdyb3VwKDEyLDMpOwpmb3IgZyBpbiBHOgogICAgICAgIFNnLmFwcGVuZChnKTsKU2c7"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>

  File "/private/var/folders/1p/k79gxccd5r538784rqx_15fh0000gt/T/tmpc0eEFP/___code___.py", line 5, in <module>
    for g in G:
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 642, in __iter__
    for i in range(1, len(self)+1):
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 1014, in __len__
    return int(self.Length())
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 588, in __call__
    return self._obj.parent().function_call(self._name, [self._obj] + list(args), kwds)
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 896, in function_call
    ['%s=%s'%(key,value.name()) for key, value in kwds.items()])))
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 570, in eval
    result = Expect.eval(self, input_line, **kwds)
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/expect.py", line 1224, in eval
    for L in code.split('\n') if L != ''])
  File "/Applications/Sage-6.5.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 769, in _eval_line
    raise RuntimeError(message)
RuntimeError: Gap produced error output
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `Length' on 1 arguments

   executing Length($sage3);

How can I fix this?

I want to do elementary operations and comparisons with elements of the GAP group G, and then store them in a list and do further comparisons.