Package: python3-pysrt
Version: 1.0.1-3
Severity: normal

SubRipFile.open() and any use of the included srt command line tool fail
because the pysrt code uses the outdated 'U' mode which has since been
removed (traceback below). This has been fixed upstream for a while [1],
so updating the package should be enough to fix this bug.

For library use, loading the file outside pysrt and having pysrt parse
the string is a workaround.

[1]
https://github.com/byroot/pysrt/commit/17e1f58dab58b941abcbd035d9c6e2fcacba5600


Traceback (most recent call last):
  File "/usr/bin/srt", line 33, in <module>
    sys.exit(load_entry_point('pysrt==1.0.1', 'console_scripts', 'srt')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pysrt/commands.py", line 215, in
main
    SubRipShifter().run(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/pysrt/commands.py", line 136, in run
    self.arguments.action()
  File "/usr/lib/python3/dist-packages/pysrt/commands.py", line 159, in
rate
    self.input_file.shift(ratio=ratio)
    ^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pysrt/commands.py", line 197, in
input_file
    self._source_file = SubRipFile.open(self.arguments.file,
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pysrt/srtfile.py", line 152, in open
    source_file = cls._open_unicode_file(path, claimed_encoding=encoding)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pysrt/srtfile.py", line 293, in
_open_unicode_file
    source_file = codecs.open(path, 'rU', encoding=encoding)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen codecs>", line 918, in open
ValueError: invalid mode: 'rUb'



-- System Information:
Debian Release: trixie/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.5.0-4-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE
not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-pysrt depends on:
ii  python3                3.11.4-5+b1
ii  python3-chardet        5.2.0+dfsg-1
ii  python3-pkg-resources  68.1.2-2

python3-pysrt recommends no packages.

python3-pysrt suggests no packages.

-- debconf-show failed

Reply via email to