[GRASS-dev] [GRASS GIS] #3662: pygrass open vector fails in python3

#3662: pygrass open vector fails in python3
-------------------------+-------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.8.0
Component: PyGRASS | Version: unspecified
Keywords: python3 | CPU: Unspecified
Platform: Unspecified |
-------------------------+-------------------------
Opening vector map using PyGRASS fails in Python3:

{{{
>>> from grass.pygrass.vector import Vector
>>> s = Vector('streams')
>>> s.open('r')
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/opt/src/grass7_trunk_py3/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/vector/abstract.py", line 380, in open
     self.table = self.dblinks.by_layer(layer).table()
   File "/opt/src/grass7_trunk_py3/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/vector/table.py", line 801, in table
     return Table(self.table_name, self.connection(), self.key)
   File "/opt/src/grass7_trunk_py3/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/vector/table.py", line 764, in connection
     dbpath = get_path(self.database, self.table_name)
   File "/opt/src/grass7_trunk_py3/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/vector/table.py", line 67, in get_path
     if "$" not in path:
   File "/opt/src/grass7_trunk_py3/dist.x86_64-pc-linux-
gnu/etc/python/grass/lib/ctypes_preamble.py", line 78, in __contains__
     return char in self.data
TypeError: a bytes-like object is required, not 'str'
}}}

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

#3662: pygrass open vector fails in python3
--------------------------+-------------------------
  Reporter: martinl | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.0
Component: PyGRASS | Version: svn-trunk
Resolution: | Keywords: python3
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------
Changes (by martinl):

* version: unspecified => svn-trunk

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

#3662: pygrass open vector fails in python3
--------------------------+-------------------------
  Reporter: martinl | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.0
Component: PyGRASS | Version: svn-trunk
Resolution: | Keywords: python3
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by annakrat):

In [changeset:"73435" 73435]:
{{{
#!CommitTicketReference repository="" revision="73435"
pygrass: fix for Python 3, see #3662
}}}

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

#3662: pygrass open vector fails in python3
--------------------------+-------------------------
  Reporter: martinl | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.8.0
Component: PyGRASS | Version: svn-trunk
Resolution: fixed | Keywords: python3
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------
Changes (by martinl):

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

Comment:

{{{
>>> s.is_open()
True
}}}

works for me. Thanks for quick fix!

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