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

IndexError: tuple index out of range #3

Closed
jeffscrum opened this issue Apr 7, 2023 · 9 comments
Closed

IndexError: tuple index out of range #3

jeffscrum opened this issue Apr 7, 2023 · 9 comments

Comments

@jeffscrum
Copy link

jeffscrum commented Apr 7, 2023

It works, but after a while it drops out with an error

Traceback (most recent call last):
  File "/root/nudecrawler/bin/nudecrawler", line 467, in <module>
    main()
  File "/root/nudecrawler/bin/nudecrawler", line 456, in main
    check_word(w, day, args.fails, print_urls = args.urls, resumecount=resumecount)
  File "/root/nudecrawler/bin/nudecrawler", line 263, in check_word
    p = analyse(url)
  File "/root/nudecrawler/bin/nudecrawler", line 165, in analyse
    p.check_all()
  File "/usr/local/lib/python3.9/dist-packages/nudecrawler/page.py", line 150, in check_all
    self.check_images()
  File "/usr/local/lib/python3.9/dist-packages/nudecrawler/page.py", line 318, in check_images
    self.is_nude(url)
  File "/usr/local/lib/python3.9/dist-packages/nudecrawler/page.py", line 290, in is_nude
    self.do_detect_image(url)
  File "/usr/local/lib/python3.9/dist-packages/nudecrawler/page.py", line 246, in do_detect_image
    verdict = ri.detect_image(self.detect_image)
  File "/usr/local/lib/python3.9/dist-packages/nudecrawler/remoteimage.py", line 60, in detect_image
    return n.parse().result
  File "/usr/local/lib/python3.9/dist-packages/nude.py", line 90, in parse
    b = pixels[x, y][2]   # blue
IndexError: tuple index out of range

Python 3.9.2
Debian 11.6

Use with wordlist.txt and urls.txt from here

@yaroslaff
Copy link
Owner

Thank you for reporting problem.

Could you please reproduce problem with new version (0.3.8). Problem should persist, but nudecrawler will print error message and stop. Then, run it again with same arguments and add --bugreport to send anonymous bugreport (I will see image URL and page URL), so I could play with same page myself and fix bug.

Also (not really related to this bug), new docker version is available:
docker run --rm -v /tmp/run:/work yaroslaff/nudecrawler nudecrawler -a Eva "Sasha Grey" "Belle Delphine" Amouranth

@jeffscrum
Copy link
Author

Now I get error with start nudecrawler

root@NudeCrawler:~/nudecrawler# python3 bin/nudecrawler -a Eva "Sasha Grey"
Traceback (most recent call last):
  File "/root/nudecrawler/bin/nudecrawler", line 20, in <module>
    from nudecrawler.verbose import printv, bugreport
ImportError: cannot import name 'bugreport' from 'nudecrawler.verbose' (/usr/local/lib/python3.9/dist-packages/nudecrawler/verbose.py)

It is not crucial for me to use the non-docker version. I will try it with docker

@yaroslaff
Copy link
Owner

Looks like you have new nudecrawler binary, but old nudecrawler package (so, your old nudecrawler.verbose has no "bugreport").
See https://github.com/yaroslaff/nudecrawler/blob/master/nudecrawler/verbose.py - there is "bugreport" function.

Maybe you installed/upgraded package in one location (e.g. in virtualenv or as user) but run global /usr/local/bin/nudecrawler? (so, your nudecrawler is from newer version, but it loads older package). Maybe worth to uninstall it completely and then install again.

I use mostly non-docker version, and it should be little faster. Docker is just released and could be even less stable. But all bugs will be caught and fixed :-)

@jeffscrum
Copy link
Author

I will try to use virtualenv and will give you feedback

@Maz0lka
Copy link

Maz0lka commented Apr 11, 2023

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/urllib/request.py", line 1346, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/local/lib/python3.9/http/client.py", line 1285, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1331, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1280, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.9/http/client.py", line 980, in send
    self.connect()
  File "/usr/local/lib/python3.9/http/client.py", line 1454, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "/usr/local/lib/python3.9/ssl.py", line 501, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/local/lib/python3.9/ssl.py", line 1041, in _create
    self.do_handshake()
  File "/usr/local/lib/python3.9/ssl.py", line 1310, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1129)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/nudecrawler/page.py", line 101, in __init__
    page = urllib.request.urlopen(self.url)
  File "/usr/local/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/local/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.9/urllib/request.py", line 1389, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/local/lib/python3.9/urllib/request.py", line 1349, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error EOF occurred in violation of protocol (_ssl.c:1129)>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/nudecrawler", line 500, in <module>
    main()
  File "/usr/local/bin/nudecrawler", line 488, in main
    check_word(w, day, args.fails, print_urls = args.urls, resumecount=resumecount)
  File "/usr/local/bin/nudecrawler", line 297, in check_word
    p = analyse(url)
  File "/usr/local/bin/nudecrawler", line 175, in analyse
    p = Page(url, all_found=all_found,
  File "/usr/local/lib/python3.9/site-packages/nudecrawler/page.py", line 120, in __init__
    self.http_code = e.status
AttributeError: 'URLError' object has no attribute 'status'```

@yaroslaff
Copy link
Owner

@Maz0lka Thank you for bugreport, please check latest version 0.3.12 (just published few minutes ago).

@jeffscrum
Copy link
Author

Could you please reproduce problem with new version (0.3.8). Problem should persist, but nudecrawler will print error message and stop. Then, run it again with same arguments and add --bugreport to send anonymous bugreport (I will see image URL and page URL), so I could play with same page myself and fix bug.

Sending bugreport....
{
    "subject": "nudecrawler automatic bugreport",
    "accessKey": "8b53121d-d362-49de-813f-507238984803",
    "$page_url": "https://telegra:ph/-04-04-5",
    "$image_url": "https://telegra:ph/file/6a7f8b7fc5f8ae5c71329:jpg",
    "$detector": ":nude",
    "$exception": "image file is truncated (8 bytes not processed)"
}

Caught an error on

Problem page: https://telegra.ph/-04-04-5
Problem image: https://telegra.ph/file/6a7f8b7fc5f8ae5c71329.jpg

@yaroslaff
Copy link
Owner

Thank you!
Try version 0.3.14, it will ignore this kind of errors and continue to work

@jeffscrum
Copy link
Author

jeffscrum commented Apr 12, 2023

I found out that the problem does not reproduce if you ignore pages with 1 photo and run with the parameters --min-content-length 2

Thanks for resolve the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants