[GRASS-dev] pyGRASS strange error on loading raster modules shortcuts

Hi,

this is found on a cluster, it is running on Pythn 2.6.6, it is a 64 bit system
the svn tree is few days old, updating it now.

creating an issue here (it seems):
from grass.pygrass.modules.shortcuts import raster as r

---------------
Traceback (most recent call last):
  File "./python-pygrass.py", line 54, in <module>
    from grass.pygrass.modules.shortcuts import raster as r
  File "/home/ychemin/grass_dev/grass-install/grass-7.0.svn/etc/python/grass/pygrass/__init__.py",
line 17, in <module>
    import modules
  File "/home/ychemin/grass_dev/grass-install/grass-7.0.svn/etc/python/grass/pygrass/modules/__init__.py",
line 8, in <module>
    import interface
  File "/home/ychemin/grass_dev/grass-install/grass-7.0.svn/etc/python/grass/pygrass/modules/interface/__init__.py",
line 9, in <module>
    import module
  File "/home/ychemin/grass_dev/grass-install/grass-7.0.svn/etc/python/grass/pygrass/modules/interface/module.py",
line 11, in <module>
    from xml.etree.ElementTree import fromstring
  File "/usr/lib64/python2.6/xml/etree/ElementTree.py", line 758, in <module>
    _escape = re.compile(eval(r'u"[&<>\"\u0080-\uffff]+"'))
  File "/usr/lib64/python2.6/re.py", line 190, in compile
    return _compile(pattern, flags)
  File "/usr/lib64/python2.6/re.py", line 243, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/usr/lib64/python2.6/sre_compile.py", line 510, in compile
    code = _code(p, flags)
  File "/usr/lib64/python2.6/sre_compile.py", line 495, in _code
    _compile(code, p.data, flags)
  File "/usr/lib64/python2.6/sre_compile.py", line 88, in _compile
    _compile(code, av[2], flags)
  File "/usr/lib64/python2.6/sre_compile.py", line 63, in _compile
    _compile_charset(av, flags, code, fixup)
  File "/usr/lib64/python2.6/sre_compile.py", line 189, in _compile_charset
    for op, av in _optimize_charset(charset, fixup):
  File "/usr/lib64/python2.6/sre_compile.py", line 232, in _optimize_charset
    return _optimize_unicode(charset, fixup)
  File "/usr/lib64/python2.6/sre_compile.py", line 352, in _optimize_unicode
    mapping = array.array('b', mapping).tostring()
TypeError: __new__() takes at most 2 arguments (3 given)

--
----

Hi Yann,

On Thu, Jun 27, 2013 at 3:20 AM, Yann Chemin <ychemin@gmail.com> wrote:

Hi,

this is found on a cluster, it is running on Pythn 2.6.6, it is a 64 bit system
the svn tree is few days old, updating it now.

Can you open a python2.6.6 shell and try this import:

from xml.etree.ElementTree import fromstring

Do you receive the same error?

TypeError: __new__() takes at most 2 arguments (3 given)

Pietro

Hi Yann,

I've compiled python2.6.6 and installed on my user home.
Then distclean and re-copile grass7 and it is working on my machine,
as you can see:

GRASS 7.0.svn (nc_basic_spm_grass7):~ > python
Python 2.6.6 (r266:84292, Jun 28 2013, 19:43:23)
[GCC 4.8.1] on linux3
Type "help", "copyright", "credits" or "license" for more information.

from grass.pygrass.modules.shortcuts import raster as r
from grass.pygrass.modules.shortcuts import imagery as i
from grass.pygrass.modules.shortcuts import display as d

I don't know how can I help you to solve this problem...

Traceback (most recent call last):
  File "/usr/lib64/python2.6/sre_compile.py", line 352, in _optimize_unicode
    mapping = array.array('b', mapping).tostring()
TypeError: __new__() takes at most 2 arguments (3 given)

As you can see the error is raised from the internal libraries of python...

Maybe you can try re-compiling and installing python locally in your home...

Best regards

Pietro