mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
12.02k stars 978 forks source link

Connection aborted during compilation (compilation failed) #6387

Open Yasand123 opened 1 month ago

Yasand123 commented 1 month ago

I get the following error when trying to compile the latest version (1.27.7):

======================================================================
ERROR: test_init (test_extractor.TestExtractorModule.test_init)
Test for exceptions in Extractor.initialize() and .finalize()
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/john/.cache/yay/gallery-dl/src/gallery-dl/gallery_dl/cache.py", line 32, in __call__
    value = self.cache[key]
            ~~~~~~~~~~^^^^^
KeyError: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/john/.cache/yay/gallery-dl/src/gallery-dl/test/test_extractor.py", line 177, in test_init
    extr.initialize()
  File "/home/batman/.cache/yay/gallery-dl/src/gallery-dl/gallery_dl/extractor/common.py", line 74, in initialize
    self._init()
  File "/home/john/.cache/yay/gallery-dl/src/gallery-dl/gallery_dl/extractor/8chan.py", line 30, in _init
    tos = self.cookies_tos_name()
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/john/.cache/yay/gallery-dl/src/gallery-dl/gallery_dl/cache.py", line 34, in __call__
    value = self.cache[key] = self.func(*args, **kwargs)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/john/.cache/yay/gallery-dl/src/gallery-dl/gallery_dl/extractor/8chan.py", line 37, in cookies_tos_name
    response = self.request(url, headers=headers, allow_redirects=False)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/john/.cache/yay/gallery-dl/src/gallery-dl/gallery_dl/extractor/common.py", line 243, in request
    raise exception.HttpError(msg, response)
gallery_dl.exception.HttpError: ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

----------------------------------------------------------------------

Using a VPN allowed me to compile. So I suspect some adult website it's trying to reach is blocked where I live. I can understand that during usage, but during compilation?

kattjevfel commented 1 month ago

I should probably be adding some exceptions for the tests, like yt-dlp has -m "not download", but honestly I'm a bit lost on which tests I should be avoiding here. (I'm the AUR package maintainer)

Haven't personally ran into this, but should probably not download stuff during building :P

mikf commented 1 month ago

This is on me. I've accidentally added a network request during extractor initialization in d7e34e1dc3b981d0555dffdccfa67cadcb115158. This will be removed and I'll also add another test to make sure this won't happen again.

mikf commented 1 month ago

I'm a bit lost on which tests I should be avoiding here

https://github.com/mikf/gallery-dl/blob/7e43c9292dbcc0215ecc3a1bdc55acb61d5361ab/test/test_extractor.py#L169

kattjevfel commented 1 month ago

So normally the tests are not supposed to connect to the internet, then?

mikf commented 1 month ago

Generally no, at least not during make test.

There are 3 OAuth tests which try to connect to http://term.ie/oauth/example in test_oauth.py, but this server hasn't been available for several years and the tests just get skipped.

mikf commented 1 month ago

Applying https://github.com/mikf/gallery-dl/commit/3cbf15a1074fccf8824f8425cdcfac8c14ff3072 as temporary patch should fix this.

kattjevfel commented 4 weeks ago

I've cherry picked the commit to the pkgbuild, hopefully this resolves the issue for anyone on a restricted network. I can't test this myself.