File "/Users/ilya/opt/programming/catbo/backend-env11/lib/python3.11/site-packages/pysrt/srtfile.py", line 153, in open
new_file.read(source_file, error_handling=error_handling)
File "/Users/ilya/opt/programming/catbo/backend-env11/lib/python3.11/site-packages/pysrt/srtfile.py", line 181, in read
self.extend(self.stream(source_file, error_handling=error_handling))
File "/opt/homebrew/Cellar/python@3.11/3.11.7/Frameworks/Python.framework/Versions/3.11/lib/python3.11/collections/__init__.py", line 1324, in extend
self.data.extend(other)
File "/Users/ilya/opt/programming/catbo/backend-env11/lib/python3.11/site-packages/pysrt/srtfile.py", line 215, in stream
cls._handle_error(error, error_handling, index)
File "/Users/ilya/opt/programming/catbo/backend-env11/lib/python3.11/site-packages/pysrt/srtfile.py", line 311, in _handle_error
sys.stderr.write(error.args[0].encode('ascii', 'replace'))
TypeError: write() argument must be str, not bytes
Hi, I open .srt files with
error_handling=SubRipFile.ERROR_LOG
, and it works fine in Py2 but not in Py3.In case of a wrongly formatted srt file pysrt tries to write bytes into sys.stderr:
So we get in Py3: