[GRASS-dev] [GRASS GIS] #2708: Run GRASS with Python3

GRASS GIS trac at osgeo.org
Thu Jul 23 09:13:45 PDT 2015


#2708: Run GRASS with Python3
--------------------------+-------------------------
  Reporter:  zarch        |      Owner:  grass-dev@…
      Type:  defect       |     Status:  new
  Priority:  normal       |  Milestone:  7.0.1
 Component:  Default      |    Version:  unspecified
Resolution:               |   Keywords:
       CPU:  Unspecified  |   Platform:  Unspecified
--------------------------+-------------------------

Comment (by zarch):

 Replying to [comment:5 glynn]:
 > Replying to [comment:4 zarch]:
 > > Do you think that I could commit these changes in trunk?
 >
 > What's the oldest Python 2.x version they will work with?

 I did some test with:
 - Python 2.6.9
 - Python 2.7.10
 - Python 3.4.3

 > Support for 2.7 is essential. We've been trying to maintain support for
 2.6,
 > but that may have to change in order to support 3.x.

 I thjink should be possible to write code that it is compatible with
 2.6/2.7 and 3.4.
 I will test for few more days and then I will commit in trunk if there are
 no objections


 > > But these files are generated with make and I don't understand where
 should I change the code. Any hint?
 >
 > The lib/python/ctypes/fix.sed script inserts those imports.

 Thank you it works!

 Now I get:

 {{{
 In [1]: from grass.lib import gis
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)
 <ipython-input-1-9c20dc5e4f67> in <module>()
 ----> 1 from grass.lib import gis

 /home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-
 gnu/etc/python/grass/lib/gis.py in <module>()
     800 ]
     801 struct_anon_11._fields_ = [
 --> 802     ('__val', c_ulong * (1024 / (8 * sizeof(c_ulong)))),
     803 ]
     804

 TypeError: can't multiply sequence by non-int of type 'float'
 }}}

 Testing with the python debugger:

 {{{
 ipdb> (1024 / (8 * sizeof(c_ulong)))
 16.0
 ipdb> c_ulong * (1024 / (8 * sizeof(c_ulong)))
 *** TypeError: can't multiply sequence by non-int of type 'float'
 }}}

 Do you have an idea on how we can fix this?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2708#comment:6>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list