[GRASS GIS] #3641: python3/ctypes: ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected LP_struct_Cell_head instance instead of LP_struct_Cell_head

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[GRASS GIS] #3641: python3/ctypes: ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected LP_struct_Cell_head instance instead of LP_struct_Cell_head

GRASS GIS
#3641: python3/ctypes: ctypes.ArgumentError: argument 2: <type
'exceptions.TypeError'>: expected LP_struct_Cell_head instance instead of
LP_struct_Cell_head
----------------------------+-------------------------
 Reporter:  mlennert        |      Owner:  grass-dev@…
     Type:  defect          |     Status:  new
 Priority:  normal          |  Milestone:  7.8.0
Component:  Python          |    Version:  unspecified
 Keywords:  Python3 ctypes  |        CPU:  Unspecified
 Platform:  Unspecified     |
----------------------------+-------------------------
 In a script using i.cutlines which in turn uses GridModule I suddenly get
 the following error using trunk:

 {{{
 Traceback (most recent call last):
   File "/home/mlennert/.grass7/addons/scripts/i.cutlines", line 673, in
 <module>
     main()
   File "/home/mlennert/.grass7/addons/scripts/i.cutlines", line 278, in
 main
     grd.run()
   File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
 gnu/etc/python/grass/pygrass/modules/grid/grid.py", line 568, in run
     self.patch()
   File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
 gnu/etc/python/grass/pygrass/modules/grid/grid.py", line 609, in patch
     self.start_row, self.start_col, self.out_prefix)
   File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
 gnu/etc/python/grass/pygrass/modules/grid/patch.py", line 91, in
 rpatch_map
     rpatch_row(rast, rrasts, rbbox)
   File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
 gnu/etc/python/grass/pygrass/modules/grid/patch.py", line 41, in
 rpatch_row
     sei = get_start_end_index(bboxes)
   File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
 gnu/etc/python/grass/pygrass/modules/grid/patch.py", line 25, in
 get_start_end_index
     r_start, c_start = coor2pixel((bbox.west, bbox.north), reg)
   File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
 gnu/etc/python/grass/pygrass/utils.py", line 180, in coor2pixel
     return (libraster.Rast_northing_to_row(north, region.byref()),
 ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected
 LP_struct_Cell_head instance instead of LP_struct_Cell_head
 }}}

 I do not have this error with 7.6.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3641>
GRASS GIS <https://grass.osgeo.org>


_______________________________________________
grass-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: [GRASS GIS] #3641: python3/ctypes: ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected LP_struct_Cell_head instance instead of LP_struct_Cell_head

Moritz Lennert
Hi Anna,

Any idea where this comes from ? It currently keeps me from using trunk.

Moritz

On 11/09/18 14:59, GRASS GIS wrote:

> #3641: python3/ctypes: ctypes.ArgumentError: argument 2: <type
> 'exceptions.TypeError'>: expected LP_struct_Cell_head instance instead of
> LP_struct_Cell_head
> ----------------------------+-------------------------
>   Reporter:  mlennert        |      Owner:  grass-dev@…
>       Type:  defect          |     Status:  new
>   Priority:  normal          |  Milestone:  7.8.0
> Component:  Python          |    Version:  unspecified
>   Keywords:  Python3 ctypes  |        CPU:  Unspecified
>   Platform:  Unspecified     |
> ----------------------------+-------------------------
>   In a script using i.cutlines which in turn uses GridModule I suddenly get
>   the following error using trunk:
>
>   {{{
>   Traceback (most recent call last):
>     File "/home/mlennert/.grass7/addons/scripts/i.cutlines", line 673, in
>   <module>
>       main()
>     File "/home/mlennert/.grass7/addons/scripts/i.cutlines", line 278, in
>   main
>       grd.run()
>     File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>   gnu/etc/python/grass/pygrass/modules/grid/grid.py", line 568, in run
>       self.patch()
>     File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>   gnu/etc/python/grass/pygrass/modules/grid/grid.py", line 609, in patch
>       self.start_row, self.start_col, self.out_prefix)
>     File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>   gnu/etc/python/grass/pygrass/modules/grid/patch.py", line 91, in
>   rpatch_map
>       rpatch_row(rast, rrasts, rbbox)
>     File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>   gnu/etc/python/grass/pygrass/modules/grid/patch.py", line 41, in
>   rpatch_row
>       sei = get_start_end_index(bboxes)
>     File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>   gnu/etc/python/grass/pygrass/modules/grid/patch.py", line 25, in
>   get_start_end_index
>       r_start, c_start = coor2pixel((bbox.west, bbox.north), reg)
>     File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>   gnu/etc/python/grass/pygrass/utils.py", line 180, in coor2pixel
>       return (libraster.Rast_northing_to_row(north, region.byref()),
>   ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected
>   LP_struct_Cell_head instance instead of LP_struct_Cell_head
>   }}}
>
>   I do not have this error with 7.6.
>
>
>
> _______________________________________________
> grass-dev mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/grass-dev
>


_______________________________________________
grass-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: [GRASS GIS] #3641: python3/ctypes: ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected LP_struct_Cell_head instance instead of LP_struct_Cell_head

Anna Petrášová
I can't reproduce it with the example from manual.

It's obviously a ctypes problem, that's one of the issues I haven't been able to solve, although I thought this comes up only with Python 3, not 2. That's why I wanted to branch 7.6 first because I knew it might take some time to get these problem fixed in trunk.

On Thu, Sep 13, 2018 at 8:49 AM Moritz Lennert <[hidden email]> wrote:
Hi Anna,

Any idea where this comes from ? It currently keeps me from using trunk.

Moritz

On 11/09/18 14:59, GRASS GIS wrote:
> #3641: python3/ctypes: ctypes.ArgumentError: argument 2: <type
> 'exceptions.TypeError'>: expected LP_struct_Cell_head instance instead of
> LP_struct_Cell_head
> ----------------------------+-------------------------
>   Reporter:  mlennert        |      Owner:  grass-dev@…
>       Type:  defect          |     Status:  new
>   Priority:  normal          |  Milestone:  7.8.0
> Component:  Python          |    Version:  unspecified
>   Keywords:  Python3 ctypes  |        CPU:  Unspecified
>   Platform:  Unspecified     |
> ----------------------------+-------------------------
>   In a script using i.cutlines which in turn uses GridModule I suddenly get
>   the following error using trunk:
>
>   {{{
>   Traceback (most recent call last):
>     File "/home/mlennert/.grass7/addons/scripts/i.cutlines", line 673, in
>   <module>
>       main()
>     File "/home/mlennert/.grass7/addons/scripts/i.cutlines", line 278, in
>   main
>       grd.run()
>     File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>   gnu/etc/python/grass/pygrass/modules/grid/grid.py", line 568, in run
>       self.patch()
>     File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>   gnu/etc/python/grass/pygrass/modules/grid/grid.py", line 609, in patch
>       self.start_row, self.start_col, self.out_prefix)
>     File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>   gnu/etc/python/grass/pygrass/modules/grid/patch.py", line 91, in
>   rpatch_map
>       rpatch_row(rast, rrasts, rbbox)
>     File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>   gnu/etc/python/grass/pygrass/modules/grid/patch.py", line 41, in
>   rpatch_row
>       sei = get_start_end_index(bboxes)
>     File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>   gnu/etc/python/grass/pygrass/modules/grid/patch.py", line 25, in
>   get_start_end_index
>       r_start, c_start = coor2pixel((bbox.west, bbox.north), reg)
>     File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>   gnu/etc/python/grass/pygrass/utils.py", line 180, in coor2pixel
>       return (libraster.Rast_northing_to_row(north, region.byref()),
>   ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected
>   LP_struct_Cell_head instance instead of LP_struct_Cell_head
>   }}}
>
>   I do not have this error with 7.6.
>
>
>
> _______________________________________________
> grass-dev mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/grass-dev
>



_______________________________________________
grass-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: [GRASS GIS] #3641: python3/ctypes: ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected LP_struct_Cell_head instance instead of LP_struct_Cell_head

Moritz Lennert
On 13/09/18 16:59, Anna Petrášová wrote:
> I can't reproduce it with the example from manual.

Ok, I'll try to see if I can create a reproducible test cast.

Moritz

>
> It's obviously a ctypes problem, that's one of the issues I haven't been
> able to solve, although I thought this comes up only with Python 3, not
> 2. That's why I wanted to branch 7.6 first because I knew it might take
> some time to get these problem fixed in trunk.
>
> On Thu, Sep 13, 2018 at 8:49 AM Moritz Lennert
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Hi Anna,
>
>     Any idea where this comes from ? It currently keeps me from using trunk.
>
>     Moritz
>
>     On 11/09/18 14:59, GRASS GIS wrote:
>      > #3641: python3/ctypes: ctypes.ArgumentError: argument 2: <type
>      > 'exceptions.TypeError'>: expected LP_struct_Cell_head instance
>     instead of
>      > LP_struct_Cell_head
>      > ----------------------------+-------------------------
>      >   Reporter:  mlennert        |      Owner:  grass-dev@…
>      >       Type:  defect          |     Status:  new
>      >   Priority:  normal          |  Milestone:  7.8.0
>      > Component:  Python          |    Version:  unspecified
>      >   Keywords:  Python3 ctypes  |        CPU:  Unspecified
>      >   Platform:  Unspecified     |
>      > ----------------------------+-------------------------
>      >   In a script using i.cutlines which in turn uses GridModule I
>     suddenly get
>      >   the following error using trunk:
>      >
>      >   {{{
>      >   Traceback (most recent call last):
>      >     File "/home/mlennert/.grass7/addons/scripts/i.cutlines", line
>     673, in
>      >   <module>
>      >       main()
>      >     File "/home/mlennert/.grass7/addons/scripts/i.cutlines", line
>     278, in
>      >   main
>      >       grd.run()
>      >     File
>     "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>      >   gnu/etc/python/grass/pygrass/modules/grid/grid.py", line 568,
>     in run
>      >       self.patch()
>      >     File
>     "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>      >   gnu/etc/python/grass/pygrass/modules/grid/grid.py", line 609,
>     in patch
>      >       self.start_row, self.start_col, self.out_prefix)
>      >     File
>     "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>      >   gnu/etc/python/grass/pygrass/modules/grid/patch.py", line 91, in
>      >   rpatch_map
>      >       rpatch_row(rast, rrasts, rbbox)
>      >     File
>     "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>      >   gnu/etc/python/grass/pygrass/modules/grid/patch.py", line 41, in
>      >   rpatch_row
>      >       sei = get_start_end_index(bboxes)
>      >     File
>     "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>      >   gnu/etc/python/grass/pygrass/modules/grid/patch.py", line 25, in
>      >   get_start_end_index
>      >       r_start, c_start = coor2pixel((bbox.west, bbox.north), reg)
>      >     File
>     "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
>      >   gnu/etc/python/grass/pygrass/utils.py", line 180, in coor2pixel
>      >       return (libraster.Rast_northing_to_row(north, region.byref()),
>      >   ctypes.ArgumentError: argument 2: <type
>     'exceptions.TypeError'>: expected
>      >   LP_struct_Cell_head instance instead of LP_struct_Cell_head
>      >   }}}
>      >
>      >   I do not have this error with 7.6.
>      >
>      >
>      >
>      > _______________________________________________
>      > grass-dev mailing list
>      > [hidden email] <mailto:[hidden email]>
>      > https://lists.osgeo.org/mailman/listinfo/grass-dev
>      >
>
>


_______________________________________________
grass-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: [GRASS GIS] #3641: python3/ctypes: ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected LP_struct_Cell_head instance instead of LP_struct_Cell_head

GRASS GIS
In reply to this post by GRASS GIS
#3641: python3/ctypes: ctypes.ArgumentError: argument 2: <type
'exceptions.TypeError'>: expected LP_struct_Cell_head instance instead of
LP_struct_Cell_head
--------------------------+----------------------------
  Reporter:  mlennert     |      Owner:  grass-dev@…
      Type:  defect       |     Status:  new
  Priority:  normal       |  Milestone:  7.8.0
 Component:  Python       |    Version:  unspecified
Resolution:               |   Keywords:  Python3 ctypes
       CPU:  Unspecified  |   Platform:  Unspecified
--------------------------+----------------------------

Comment (by annakrat):

 I don't quite understand what exactly is going on, but there was a missing
 wrapper function which got lost during the porting and apparently it is
 needed. Try r73339.

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


_______________________________________________
grass-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-dev