Closed goohuu closed 6 years ago
Hi,
Thank you for reporting.
This only happens with python3 and is a consequence of the changed meaning of the str
type in python3.
Quick fixes: change your code to send bytes instead of string or change line 51 of transport/wsgi.py to test for str
instead of bytes
. I realize neither option is very attractive.
I may have made the wrong choice doing it this way. Later this year, during my summer vacation, I plan to do some extensive work on tinyrpc. This will include a breaking change. With that in mind, do you care to make a recommendation on how to deal with strings vs bytes in tinyrpc?
regards, Leo
Hi,
Thanks for your feedback. We will keep using 0.6 which suits our need for the time being. Unfortunately, we are not knowledgeable enough in Python to give proper recommendations on how to deal with strings vs bytes. What we will do however is to continue testing future tinyrpc versions. Don't hesitate to reach me if you need some testing/validation.
I have the same issue when using python3.
First tried to change my code to return bytes instead of string, but that results in another error:
File "/usr/lib/python3.6/json/encoder.py", line 180, in default o.__class__.__name__) TypeError: Object of type 'bytes' is not JSON serializable
Changing line 51 of transport/wsgi.py worked.
Thank you for bringing this to my attention. I will soon start work on v1.0 which will be Python 3 only. With the changes that trouble you I tried to improve Python2/3 interoperability. I consider just reverting this.
reverted to old behaviour and made available on pypi as 0.9.2
We have been using tinryrpc since version 0.6 . Our code (which is very similar to the http_server_example.py) fails in version 0.7 and above with the following traceback:
We reproduced the above both in a Debian8 and a Debian9 environment. lib versions:
At your disposal for further tests or information