-
Notifications
You must be signed in to change notification settings - Fork 20
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
IndexError: list index out of range #1
Comments
Same issue! Did u guys solve this at the end? |
try this:
|
Hello,
I've tried using your code with your original picture and it worked, but with other picture such as the one below, I get the following error :
Traceback (most recent call last):
File "...", line 363, in
img.decode()
File "...", line 350, in decode
len_chunk = self.StartOfScan(data, len_chunk)
File "...", line 290, in StartOfScan
st, 0, self.quant[self.quantMapping[0]], oldlumdccoeff
File "...", line 253, in BuildMatrix
code = self.huffman_tables[0 + idx].GetCode(st)
File "...", line 201, in GetCode
res = self.Find(st)
File "...", line 196, in Find
r = r[st.GetBit()]
IndexError: list index out of range
I've looked into it and it seems that when the error occurs, r is a list of size 1, st.GetBit() is 0, but the code still fails. So I've tried to force Find to return r[0] when r is of size 1, but then another error occurs
Traceback (most recent call last):
File "...", line 363, in
img.decode()
File "...", line 350, in decode
len_chunk = self.StartOfScan(data, len_chunk)
File "...", line 290, in StartOfScan
st, 0, self.quant[self.quantMapping[0]], oldlumdccoeff
File "...", line 260, in BuildMatrix
code = self.huffman_tables[16 + idx].GetCode(st)
File "...", line 201, in GetCode
res = self.Find(st)
File "...", line 196, in Find
r = r[st.GetBit()]
File "...", line 218, in GetBit
b = self.data[self.pos >> 3]
IndexError: list index out of range
Any idea why this occurs ? Thanks in advance !
The text was updated successfully, but these errors were encountered: