Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during rip: "ValueError: invalid literal for int() with base 16" #48

Open
TimothyLoyer opened this issue Sep 16, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@TimothyLoyer
Copy link

I getting this error for episodes I've ripped from a few particular series. In most cases I've had no problem, but these appear to be getting something unexpected - maybe there is an edge case which needs handled? I'll see whether I can use MKVToolNix to rip the subtitle tracks.

Thank you for a great tool!

Traceback (most recent call last):
  File ".venv/lib/python3.10/site-packages/pgsrip/ripper.py", line 128, in __init__
    max_height = max([item.height for item in self.pgs.items]) // 2
  File ".venv/lib/python3.10/site-packages/pgsrip/media.py", line 161, in items
    self._items = self.decode(data, self.media_path)
  File ".venv/lib/python3.10/site-packages/pgsrip/media.py", line 184, in decode
    return PgsSubtitleItem.create_items(media_path, display_sets)
  File ".venv/lib/python3.10/site-packages/pgsrip/media.py", line 45, in create_items
    candidates.append(PgsSubtitleItem(index, media_path, current_sets))
  File ".venv/lib/python3.10/site-packages/pgsrip/media.py", line 33, in __init__
    self.x_offset = min([ds.wds.x_offset for ds in display_sets] or [None])
  File ".venv/lib/python3.10/site-packages/pgsrip/media.py", line 33, in <listcomp>
    self.x_offset = min([ds.wds.x_offset for ds in display_sets] or [None])
  File ".venv/lib/python3.10/site-packages/pgsrip/pgs.py", line 278, in x_offset
    return from_hex(self.data[2:4])
  File ".venv/lib/python3.10/site-packages/pgsrip/utils.py", line 7, in from_hex
    return int(b.hex(), base=16)
ValueError: invalid literal for int() with base 16: ''
@Cynary
Copy link

Cynary commented Apr 26, 2024

Same issue here. I'd be happy to provide a sample file for the extracted pgs subs.

@m4caque
Copy link

m4caque commented May 24, 2024

Having the same issue, too, on Ubuntu 22.04/Python 3.10:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/pgsrip/core.py", line 69, in rip_pgs
    srt = PgsToSrtRipper(p, options).rip(lambda t: rules.apply(t, '')[0])
  File "/usr/local/lib/python3.10/dist-packages/pgsrip/ripper.py", line 128, in __init__
    max_height = max([item.height for item in self.pgs.items]) // 2
  File "/usr/local/lib/python3.10/dist-packages/pgsrip/media.py", line 161, in items
    self._items = self.decode(data, self.media_path)
  File "/usr/local/lib/python3.10/dist-packages/pgsrip/media.py", line 182, in decode
    self.dump_display_sets(display_sets)
  File "/usr/local/lib/python3.10/dist-packages/pgsrip/media.py", line 189, in dump_display_sets
    f.write(f'{new_line.join([str(ds) for ds in display_sets])}')
  File "/usr/local/lib/python3.10/dist-packages/pgsrip/media.py", line 189, in <listcomp>
    f.write(f'{new_line.join([str(ds) for ds in display_sets])}')
  File "/usr/local/lib/python3.10/dist-packages/pgsrip/pgs.py", line 449, in __str__
    strings.append(f'\t{s}')
  File "/usr/local/lib/python3.10/dist-packages/pgsrip/pgs.py", line 206, in __str__
    for k, v in self.to_json().items():
  File "/usr/local/lib/python3.10/dist-packages/pgsrip/pgs.py", line 191, in to_json
    return {
  File "/usr/local/lib/python3.10/dist-packages/pgsrip/pgs.py", line 192, in <dictcomp>
    k: to_value(getattr(self, v)) for k, v in attributes.items() if getattr(self, v) is not None
  File "/usr/local/lib/python3.10/dist-packages/pgsrip/pgs.py", line 274, in window_id
    return self.data[1]
IndexError: index out of range

@ratoaq2 ratoaq2 added the bug Something isn't working label Jun 22, 2024
@ratoaq2
Copy link
Owner

ratoaq2 commented Jun 22, 2024

A sample file is needed to debug this

@m4caque
Copy link

m4caque commented Jul 2, 2024

Here's a sample file that produces the error for me:
2.sup.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants