-
-
Notifications
You must be signed in to change notification settings - Fork 656
'encoding' cannot be specified in python 3 #1155
Comments
@jonapich I'm having problems trying to create a test case for this issue. Have an example of sentry data where this exception is raised? |
No I don't. I'm not sure a sentry was even raised for this, it probably ended up in our logs instead. I guess there was some invalid UTF data in the exception/locals somewhere? |
@ashwoods we experience this too. The code puts Let me know if you need anything else for debugging. |
@jonapich In our case, there was a type with custom |
@cenkalti I only have the stacktrace I posted above, sorry. |
I don't think this should be closed. I am seeing this still, and it's a bit confusing, but here is what is happening. We have this code in Sentry: raven-python/raven/utils/json.py Lines 46 to 51 in 1a0d697
The logic here seems to be: Try to serialize everything to JSON, and if that fails for any reason, try it again, but this time use a special codec that ignores any errors. (Question: Why use a catch-all here, rather than just catching encoding-related exceptions?). The problem, as stated above, is that on Python 3, the
So the task here would probably to a) find a way to support the fallback-branch on Python 3, or disable the fallback branch on Py3 so the exception is less confusing. |
This is a simple script to reproduce the issue:
I agree that the catchall is misleading and the utf-8 encoding hack should not be tried in Py3. In particular, in my application the un-jsonifiable object is in Raven's breadcrumbs and it looks like this:
Note the tuple as key in the 'data' dictionary. Simply using |
Any update on this issue? I am still getting the exact same error message on raven version 6.10.0. |
If you can have the raven fixed, could you make a PR for that? |
raven-python/raven/utils/json.py
Line 50 in 1a0d697
The 'json.dumps' command no longer have an encoding argument in python 3 and causes this stacktrace:
The text was updated successfully, but these errors were encountered: