Opened 5 years ago

Closed 4 years ago

#4023 closed defect (fixed)

TypeError: a bytes-like object is required, not 'str'

Reported by: pvanbosgeo Owned by: grass-dev@…
Priority: normal Milestone:
Component: Default Version: unspecified
Keywords: Cc:
CPU: Unspecified Platform: MSWindows

Description

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.

Change History (3)

comment:1 by annakrat, 5 years ago

Should be enough to remove 'b' from:

fileConf = open(confilename, 'wb')

comment:2 by neteler, 4 years ago

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

in reply to:  2 comment:3 by pvanbosgeo, 4 years ago

Resolution: fixed
Status: newclosed

Replying to neteler:

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

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

Note: See TracTickets for help on using tickets.