[GRASS-dev] [GRASS GIS] #3777: vector digitizer crashes with python 3

#3777: vector digitizer crashes with python 3
---------------------------------------+-------------------------
Reporter: veroandreo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Keywords: vector digitizer, python3 | CPU: Unspecified
Platform: Linux |
---------------------------------------+-------------------------
When changing to vector digitizer mode in Map Display and attempting to
create a new vector map to start digitizing, it crashes and I get the
following in the GUI Console tab:

{{{
Traceback (most recent call last):
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/vdigit/toolbars.py", line 818, in
OnSelectMap

disableAdd=True)
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/gui_core/dialogs.py", line 520, in
CreateNewVector

stdin=sql)
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/core/gcmd.py", line 719, in
RunCommand

ps.stdin.write(stdin)
TypeError
:
a bytes-like object is required, not 'str'
}}}

I use trunk r74162 in a virtualenv with python3.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3777&gt;
GRASS GIS <https://grass.osgeo.org>

#3777: vector digitizer crashes with python 3
--------------------------+---------------------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: vector digitizer, python3
       CPU: Unspecified | Platform: Linux
--------------------------+---------------------------------------

Comment (by veroandreo):

This is still an issue in r74400 compiled and run in a virtualenv with
python3. If trunk is compiled with python2 as usual, it works as expected.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3777#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3777: vector digitizer crashes with python 3
--------------------------+---------------------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: vector digitizer, python3
       CPU: Unspecified | Platform: Linux
--------------------------+---------------------------------------

Comment (by veroandreo):

The error points to slightly different lines:

{{{
Traceback (most recent call last):
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/vdigit/toolbars.py", line 817, in
OnSelectMap

disableAdd=True)
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/gui_core/dialogs.py", line 524, in
CreateNewVector

stdin=sql)
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/core/gcmd.py", line 719, in
RunCommand

ps.stdin.write(stdin)
TypeError
:
a bytes-like object is required, not 'str'
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3777#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3777: vector digitizer crashes with python 3
--------------------------+---------------------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: vector digitizer, python3
       CPU: Unspecified | Platform: Linux
--------------------------+---------------------------------------

Comment (by martinl):

In [changeset:"74401" 74401]:
{{{
#!CommitTicketReference repository="" revision="74401"
vector digitizer crashes with python 3, see #3777
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3777#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#3777: vector digitizer crashes with python 3
--------------------------+---------------------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: vector digitizer, python3
       CPU: Unspecified | Platform: Linux
--------------------------+---------------------------------------

Comment (by martinl):

Hopefully fixed in r74401

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3777#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#3777: vector digitizer crashes with python 3
--------------------------+---------------------------------------
  Reporter: veroandreo | Owner: martinl
      Type: defect | Status: assigned
  Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: vector digitizer, python3
       CPU: Unspecified | Platform: Linux
--------------------------+---------------------------------------
Changes (by martinl):

* owner: grass-dev@… => martinl
* status: new => assigned
* cc: grass-dev@… (added)

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3777#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>

#3777: vector digitizer crashes with python 3
--------------------------+---------------------------------------
  Reporter: veroandreo | Owner: martinl
      Type: defect | Status: assigned
  Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: vector digitizer, python3
       CPU: Unspecified | Platform: Linux
--------------------------+---------------------------------------

Comment (by veroandreo):

Just re-compiled and tested. Now, it does not crash, but the dialog to
submit each new feature does not appear and cat is not written.
v.db.select of new vector digitized is empty.

This is what I get in the GUI console when digitizing polygons:

{{{
Traceback (most recent call last):
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/mapwin/buffered.py", line 1397, in
MouseActions

self.OnRightUp(event)
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/mapwin/buffered.py", line 1644, in
OnRightUp

self._onRightUp(event)
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/vdigit/mapwindow.py", line 1001, in
_onRightUp

action="add", ignoreError=True)
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/dbmgr/dialogs.py", line 119, in
__init__

self.UpdateDialog(query=query, cats=cats)
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/dbmgr/dialogs.py", line 442, in
UpdateDialog

self.fid = self.cats.keys()[0]
TypeError
:
'dict_keys' object is not subscriptable
Traceback (most recent call last):
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/mapwin/buffered.py", line 1397, in
MouseActions

self.OnRightUp(event)
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/mapwin/buffered.py", line 1644, in
OnRightUp

self._onRightUp(event)
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/vdigit/mapwindow.py", line 1001, in
_onRightUp

action="add", ignoreError=True)
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/dbmgr/dialogs.py", line 119, in
__init__

self.UpdateDialog(query=query, cats=cats)
   File
"/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/dbmgr/dialogs.py", line 442, in
UpdateDialog

self.fid = self.cats.keys()[0]
TypeError
:
'dict_keys' object is not subscriptable
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3777#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>

#3777: vector digitizer crashes with python 3
--------------------------+---------------------------------------
  Reporter: veroandreo | Owner: martinl
      Type: defect | Status: assigned
  Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: vector digitizer, python3
       CPU: Unspecified | Platform: Linux
--------------------------+---------------------------------------

Comment (by martinl):

See https://github.com/OSGeo/grass/pull/13

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3777#comment:7&gt;
GRASS GIS <https://grass.osgeo.org>

#3777: vector digitizer crashes with python 3
--------------------------+---------------------------------------
  Reporter: veroandreo | Owner: martinl
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Resolution: fixed | Keywords: vector digitizer, python3
       CPU: Unspecified | Platform: Linux
--------------------------+---------------------------------------
Changes (by veroandreo):

* status: assigned => closed
* resolution: => fixed

Comment:

Replying to [comment:7 martinl]:
> See https://github.com/OSGeo/grass/pull/13

Thanks! It works as expected now, closing.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3777#comment:8&gt;
GRASS GIS <https://grass.osgeo.org>