Skip to content

Commit

Permalink
properly support watchdog 4+ where events always have dest_path
Browse files Browse the repository at this point in the history
but that property can be *empty*, thus breaking `nikola auto`:

    ERROR: asyncio: Task exception was never retrieved
    future: <Task finished name='Task-57' coro=<CommandAuto.reload_page() done, defined at nikola/plugins/command/auto/__init__.py:427> exception=ValueError('no path specified')>
    Traceback (most recent call last):
      File "nikola/plugins/command/auto/__init__.py", line 440, in reload_page
        p = os.path.relpath(event_path, os.path.abspath(self.site.config['OUTPUT_FOLDER'])).replace(os.sep, '/')
      File "/usr/lib64/python3.8/posixpath.py", line 453, in relpath
        raise ValueError("no path specified")
    ValueError: no path specified
  • Loading branch information
evgeni committed May 22, 2024
1 parent ccf74ad commit a9351f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Bugfixes

* Restore `annotation_helper.tmpl` with dummy content - fix themes still mentioning it
(Issue #3764, #3773)
* Fix compatibility with watchdog 4 (Issue #3766)

New in v8.3.1
=============
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/command/auto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ async def reload_page(self, event) -> None:
# Move events have a dest_path, some editors like gedit use a
# move on larger save operations for write protection
if event:
event_path = event.dest_path if hasattr(event, 'dest_path') else event.src_path
event_path = event.dest_path if (hasattr(event, 'dest_path') and event.dest_path) else event.src_path
else:
event_path = self.site.config['OUTPUT_FOLDER']
p = os.path.relpath(event_path, os.path.abspath(self.site.config['OUTPUT_FOLDER'])).replace(os.sep, '/')
Expand Down

0 comments on commit a9351f7

Please sign in to comment.