[GRASS-dev] [GRASS GIS] #3446: GRASS python library is not working with python 3

GRASS GIS trac at osgeo.org
Fri Sep 7 15:02:10 PDT 2018


#3446: GRASS python library is not working with python 3
---------------------+-----------------------------------
  Reporter:  lrntct  |      Owner:  grass-dev@…
      Type:  defect  |     Status:  new
  Priority:  major   |  Milestone:  7.8.0
 Component:  Python  |    Version:  7.2.1
Resolution:          |   Keywords:  python python3 ctypes
       CPU:  x86-64  |   Platform:  Linux
---------------------+-----------------------------------

Comment (by martinl):

 For record, currently compilation fails (using Python 3.7) here

 {{{
 Status: gcc -E       -I/opt/src/grass7_trunk/dist.x86_64-pc-linux-
 gnu/include -I/opt/src/grass7_trunk/dist.x86_64-pc-linux-gnu/include
 -D__GLIBC_HAVE_LONG_LONG -U __GNUC__ -dD "-Dinline=" "-D__inline__="
 "-D__extension__=" "-D_Bool=uint8_t" "-D__const=const" "-D__asm__(x)="
 "-D__asm(x)=" "-DCTYPESGEN=1" "/tmp/tmpi1g2g39s.h"
 Traceback (most recent call last):
   File "/home/martin/python3-grass7/lib/python3.7/sre_parse.py", line
 1021, in parse_template
     this = chr(ESCAPES[this][1])
 KeyError: '\\x'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "./ctypesgen.py", line 162, in <module>
     descriptions = ctypesgencore.parser.parse(options.headers, options)
   File
 "/opt/src/grass7_trunk/lib/python/ctypes/ctypesgencore/parser/__init__.py",
 line 22, in parse
     parser.parse()
   File
 "/opt/src/grass7_trunk/lib/python/ctypes/ctypesgencore/parser/datacollectingparser.py",
 line 74, in parse
     ctypesparser.CtypesParser.parse(self, fname, False)
   File
 "/opt/src/grass7_trunk/lib/python/ctypes/ctypesgencore/parser/cparser.py",
 line 122, in parse
     self.preprocessor_parser.parse(filename)
   File
 "/opt/src/grass7_trunk/lib/python/ctypes/ctypesgencore/parser/preprocessor.py",
 line 226, in parse
     token = self.lexer.token()
   File
 "/opt/src/grass7_trunk/lib/python/ctypes/ctypesgencore/parser/preprocessor.py",
 line 65, in token
     result = lex.Lexer.token(self)
   File
 "/opt/src/grass7_trunk/lib/python/ctypes/ctypesgencore/parser/lex.py",
 line 359, in token
     newtok = func(tok)
   File
 "/opt/src/grass7_trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py",
 line 286, in t_ANY_string_literal
     t.value = StringLiteral(encode(t.value))
   File
 "/opt/src/grass7_trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py",
 line 84, in __new__
     r'\x0\1', value[1:-1])
   File "/home/martin/python3-grass7/lib/python3.7/re.py", line 192, in sub
     return _compile(pattern, flags).sub(repl, string, count)
   File "/home/martin/python3-grass7/lib/python3.7/re.py", line 309, in
 _subx
     template = _compile_repl(template, pattern)
   File "/home/martin/python3-grass7/lib/python3.7/re.py", line 300, in
 _compile_repl
     return sre_parse.parse_template(repl, pattern)
   File "/home/martin/python3-grass7/lib/python3.7/sre_parse.py", line
 1024, in parse_template
     raise s.error('bad escape %s' % this, len(this))
 re.error: bad escape \x at position 0
 make[1]: *** [Makefile:102: OBJ.x86_64-pc-linux-gnu/date.py] Error 1
 make[1]: Leaving directory '/opt/src/grass7_trunk/lib/python/ctypes'
 make: *** [Makefile:81: default] Error 2
 }}}

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/3446#comment:12>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list