ashwinvis / pelican-planet

Aggregate feeds into a planet asynchronously
https://codeberg.org/ashwinvis/pelican-aio-planet
GNU Affero General Public License v3.0
0 stars 0 forks source link

Resolve redirect method fails sometimes with AssertionError "port is None" #2

Open ashwinvis opened 3 years ago

ashwinvis commented 3 years ago
CRITICAL: 
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.7.9/x64/bin/pelican", line 8, in <module>
    sys.exit(main())
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pelican/__init__.py", line 512, in main
    pelican.run()
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pelican/__init__.py", line 96, in run
    ) for cls in self.get_generator_classes()
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pelican/__init__.py", line 96, in <listcomp>
    ) for cls in self.get_generator_classes()
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pelican/generators.py", line 708, in __init__
    super().__init__(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pelican/generators.py", line 237, in __init__
    **kwargs)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pelican/generators.py", line 87, in __init__
    signals.generator_init.send(self)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/blinker/base.py", line 267, in send
    for receiver in self.receivers_for(sender)]
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/blinker/base.py", line 267, in <listcomp>
    for receiver in self.receivers_for(sender)]
  File "/home/runner/work/ashwinvis.github.io/ashwinvis.github.io/src/pelican-planet/pelican_planet/__init__.py", line 50, in generate
    planet.write_page(template, destination, max_articles=max_articles)
  File "/home/runner/work/ashwinvis.github.io/ashwinvis.github.io/src/pelican-planet/pelican_planet/planet.py", line 180, in write_page
    articles = asyncio.run(self._resolve_article_urls(articles))
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
    return future.result()
  File "/home/runner/work/ashwinvis.github.io/ashwinvis.github.io/src/pelican-planet/pelican_planet/planet.py", line 145, in _resolve_article_urls
    redirected_url = await self._resolve_redirect(url)
  File "/home/runner/work/ashwinvis.github.io/ashwinvis.github.io/src/pelican-planet/pelican_planet/planet.py", line 137, in _resolve_redirect
    async with session.get(url, allow_redirects=True) as response:
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/aiohttp/client.py", line 483, in _request
    timeout=real_timeout
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/aiohttp/connector.py", line 523, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/aiohttp/connector.py", line 859, in _create_connection
    req, traces, timeout)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/aiohttp/connector.py", line 963, in _create_direct_connection
    assert port is not None
AssertionError
Makefile:85: recipe for target 'publish' failed
make: *** [publish] Error 1

Find whether it means anything from aiohttp docs. If it is not a big deal add a try...except block to circumvent this.

sharmasourab93 commented 3 years ago

Can you please assign this issue to me?

Thanks, Sourab

ashwinvis commented 3 years ago

@sharmasourab93 Thanks!

ashwinvis commented 3 years ago

Check out https://github.com/ashwinvis/ashwinvis.github.io/ where I use this plugin and have encountered the bug. Not necessary, if you understand the traceback.

sharmasourab93 commented 3 years ago

@ashwinvis I am not sure how to mirror the environement. Can you please tell me a little more about setting up the evironment and execute? I have created a virutalenv and installed all the requirements. I am not sure if the README tells me how to startup with the execution.

ashwinvis commented 3 years ago

Sounds good. Once you have followed https://github.com/ashwinvis/ashwinvis.github.io/#simple-installation, run make publish