rot13 codec does a str translate operation. But it doesn't check the input type and then the error message would be quite confusing, especially for bytes:
>>> codecs.encode(b'abc', 'rot13')
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/rot_13.py", line 15, in encode
return (input.translate(rot13_map), len(input))
TypeError: a bytes-like object is required, not 'dict'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: encoding with 'rot13' codec failed (TypeError: a bytes-like object is required, not 'dict')
|