I have a stable working project with python. It's running on python 2.7. I upgraded it to python 3.x. So, it's not working on Python3.
The logic is writing values to csv file.
Broken code is that:
csv = io.BytesIO()
csv.write('fiscalYear\t'
'VKN\t'
'recordPeriod\t'
'enteredBy\t'
'entredDate\t'
'entryNumber\t'
'entryComment\t'
'batchID\t'
'batchDescription\t'
'totalDebit\t'
'totalCredit\t'
'amountOriginalExchangeRate\t'
'amountOriginalExchangeRateSource\t'
'amountOriginalExchangeRateComment\n'
)
return csv.getvalue()
My problem is that:
Expected type 'union[bytes, bytearray], got 'str' instead
Python log error:
TypeError: a bytes-like object is required, not 'str'
I need your help!