TypeError: string argument without an encoding

You are not using the bytes function correctly. Check this:

>>> a = "hi"
>>> bytes(a, encoding='utf8')
b'hi'

You can try:

bytes((create_jsonlines(source)), encoding='utf8')

encoding is the argument of the bytes function, and you are using it outside of that function.

Leave a Comment