You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if this deserves a better clarification in the deprecation notice, but I hit a corner case that took me a few minutes to understand today. Perhaps commenting here will help someone else.
I tried replacing codecs.open with open in a spot in pandas and hit this error:
> with open(as_json, "wb", encoding="utf8") as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E ValueError: binary mode doesn't take an encoding argument
I fixed it by replacing "wb" with "w". It seems codecs.open is a little more permissive here than open.
Activity
pythongh-133036: deprecate codecs.open
gh-133036: Deprecate codecs.open (#133038)
ngoldbaum commentedon Aug 7, 2025
I don't know if this deserves a better clarification in the deprecation notice, but I hit a corner case that took me a few minutes to understand today. Perhaps commenting here will help someone else.
I tried replacing
codecs.openwithopenin a spot in pandas and hit this error:I fixed it by replacing
"wb"with"w". It seemscodecs.openis a little more permissive here thanopen.