aio-libs / aiohttp-devtools

dev tools for aiohttp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.goutputstream does not start with static

Dreamsorcerer opened this issue · comments

  • aiohttp-devtools version: latest
  • aiohttp version: latest
  • python version: 3.6
  • Platform: Ubuntu 18.04

Issue Summary

I'm frequently getting this error when the server tries to reload:

Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.6/site-packages/aiohttp_devtools/runserver/watch.py", line 68, in _run
    await src_reload(self._app, changes.pop()[1])
  File "/home/ubuntu/.local/lib/python3.6/site-packages/aiohttp_devtools/runserver/serve.py", line 160, in src_reload
    path = str(Path(app['static_url']) / Path(path).relative_to(app['static_path']))
  File "/usr/lib/python3.6/pathlib.py", line 874, in relative_to
    .format(str(self), str(formatted)))
ValueError: '/home/ubuntu/hacking/teslaclub/teslaclub_app/.goutputstream-AKHYI0' does not start with '/home/ubuntu/hacking/teslaclub/teslaclub_app/static'

Steps to reproduce

Not sure, difficult to reproduce reliably.

So, looking at the code here:
https://github.com/aio-libs/aiohttp-devtools/blob/master/aiohttp_devtools/runserver/watch.py#L68

It appears that if a single file without a ".py" extension is changed, then it call src_reload() with that path. The docstring for that function clearly states that reloading a single file is only supported for files in the static path. Therefore this reload fails, because it is ignoring this requirement.

With the changes in the linked PR, it is working reliably now.