I'm trying to debug a module, but whenever I try to print something, python 3.10 stops with the following error:
File "/usr/lib/python3.10/codecs.py", line 378, in write
self.stream.write(data)
TypeError: write() argument must be str, not bytes
This error comes whatever I am trying to print, e.g. print("abc")
or print(type(1))
. It also occurs when calling breakpoint()
, because breakpoint prints its messages to stdout, which does not work for some reason.
When calling print
in a separate python shell, it works, but not when it is called from the module which is loaded in a script.
Any ideas what might case this behaviour?
Have tried to actually print the data type with print(type(var))
and print(isinstance(var,bytes))
, but this results in the same error.