Public bug reported:

I use Ubuntu 24.04.1 LTS

the version of the pysrt package isnot compatible with python 3.11

when I try to read a file, i've the following error :

Traceback (most recent call last):
  File "/home/axel/Documents/code/LWM/stat_subtitle.py", line 29, in <module>
    subtitles = list(pysrt.open(fichier))
                     ^^^^^^^^^^^^^^^^^^^
  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'

the 'U' mode isn't available for python 3.11 :
https://docs.python.org/3/library/codecs.html
Changed in version 3.11: The 'U' mode has been removed.

the repository of pysrt hasn't this mode : 
https://github.com/byroot/pysrt/blob/master/pysrt/srtfile.py#L293

a new version of the lib is available here : 
https://github.com/byroot/pysrt/tags

Thank you

** Affects: pysrt (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: pysrt

** Tags added: pysrt

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2083105

Title:
  version 1.0.1 don't is compatible with python 3.11

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/pysrt/+bug/2083105/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to