r0oth3x49 / acloud-dl

A cross-platform python based utility to download courses from acloud.guru for personal offline use.
MIT License
350 stars 141 forks source link

re.error: global flags not at the start of the expression #103

Closed rabin-io closed 1 year ago

rabin-io commented 1 year ago

With Python 3.11 I got this error,

re.error: global flags not at the start of the expression at position 63

Traceback

Traceback (most recent call last):
  File "/acloud-dl/acloud-dl.py", line 408, in <module>
    main()
  File "/acloud-dl/acloud-dl.py", line 396, in main
    cloud_guru.course_download(path=options.output, quality=options.quality,
  File "/acloud-dl/acloud-dl.py", line 295, in course_download
    self.download_lectures_only(lecture_best=lecture_best, lecture_title=lecture_title,
  File "/acloud-dl/acloud-dl.py", line 217, in download_lectures_only
    self.download_subtitles(subtitle=lecture_subs, filepath=filepath)
  File "/acloud-dl/acloud-dl.py", line 148, in download_subtitles
    self.convert(filename=filename)
  File "/acloud-dl/acloud/_vtt2srt.py", line 106, in convert
    timecode = self._generate_timecode(seq, unescapeHTML(line))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/acloud-dl/acloud/_vtt2srt.py", line 79, in _generate_timecode
    match = re.match(self._TIMECODE, timecode, flags=re.U)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/__init__.py", line 166, in match
    return _compile(pattern, flags).match(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/_parser.py", line 980, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/_parser.py", line 455, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/_parser.py", line 841, in _parse
    raise source.error('global flags not at the start '
re.error: global flags not at the start of the expression at position 63
oregonpillow commented 1 year ago

Same issue for me on 3.11. Switched to 3.9 and it's working.

oregonpillow commented 1 year ago

The best approach would be to offer this program as a docker which would solve all future dependency issues and provide a "simply works" solution.

r0oth3x49 commented 1 year ago

Sorry @all I will try to update the code. @oregonpillow PR is welcome to dockerize this utility. @rabin-io hopefully the issue resolved with your PR. Sorry for the delayed responnse