[GRASS-dev] [GRASS GIS] #4023: TypeError: a bytes-like object is required, not 'str'

#4023: TypeError: a bytes-like object is required, not 'str'
------------------------+-------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone:
Component: Default | Version: unspecified
Keywords: | CPU: Unspecified
Platform: MSWindows |
------------------------+-------------------------
Running the addon r.diversity on grass 7.9 (Windows 10), I get the
following error:

{{{

C:\Users\hsc\Documents\GRASSGIS\scripts\r.diversity.py --overwrite
input=landschap@datamodel prefix=renyi3 alpha=0.6 method=renyi
Traceback (most recent call last):
   File
"C:\Users\hsc\Documents\GRASSGIS\scripts\r.diversity.py",
line 283, in <module>
     sys.exit(main())
   File
"C:\Users\hsc\Documents\GRASSGIS\scripts\r.diversity.py",
line 149, in main
     quiet, overwrite)
   File
"C:\Users\hsc\Documents\GRASSGIS\scripts\r.diversity.py",
line 160, in calculateM
     createConfFile(r, map_in, home)
   File
"C:\Users\hsc\Documents\GRASSGIS\scripts\r.diversity.py",
line 240, in createConfFile
     fileConf.writelines(outputLine)
TypeError: a bytes-like object is required, not 'str'
(Wed Jan 22 12:02:17 2020) Command finished (3 sec)

}}}

I guess something to do with Python2 vs Python 3 (using the latter), but I
can't pin it down.

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

#4023: TypeError: a bytes-like object is required, not 'str'
--------------------------+-------------------------
  Reporter: pvanbosgeo | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Default | Version: unspecified
Resolution: | Keywords:
       CPU: Unspecified | Platform: MSWindows
--------------------------+-------------------------

Comment (by annakrat):

Should be enough to remove 'b' from:

{{{
fileConf = open(confilename, 'wb')
}}}

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

#4023: TypeError: a bytes-like object is required, not 'str'
--------------------------+-------------------------
  Reporter: pvanbosgeo | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Default | Version: unspecified
Resolution: | Keywords:
       CPU: Unspecified | Platform: MSWindows
--------------------------+-------------------------

Comment (by neteler):

@pvanbosgeo is this still an issue? If not, please close the ticket

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

#4023: TypeError: a bytes-like object is required, not 'str'
--------------------------+-------------------------
  Reporter: pvanbosgeo | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone:
Component: Default | Version: unspecified
Resolution: fixed | Keywords:
       CPU: Unspecified | Platform: MSWindows
--------------------------+-------------------------
Changes (by pvanbosgeo):

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

Comment:

Replying to [comment:2 neteler]:
> @pvanbosgeo is this still an issue? If not, please close the ticket

Yes, these seems to be solved, thanks. Closing now

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