[GH-ISSUE #1062] [search error] FileNotFoundError: [Errno 2] No such file or directory: 'app/static/widgets/calculator.html' / v0.83 #649

Closed
opened 2026-02-25 20:36:13 +03:00 by kerem · 1 comment
Owner

Originally created by @un99known99 on GitHub (Sep 2, 2023).
Original GitHub issue: https://github.com/benbusby/whoogle-search/issues/1062

Hi,

got strange error while performing a search in 0.8.3:

return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/home/pi/.local/lib/python3.9/site-packages/app/routes.py", line 122, in decorated
return f(*args, **kwargs)
File "/home/pi/.local/lib/python3.9/site-packages/app/routes.py", line 57, in decorated
return f(*args, **kwargs)
File "/home/pi/.local/lib/python3.9/site-packages/app/routes.py", line 359, in search
response = add_calculator_card(html_soup)
File "/home/pi/.local/lib/python3.9/site-packages/app/utils/widgets.py", line 51, in add_calculator_card
widget_file = open('app/static/widgets/calculator.html')
FileNotFoundError: [Errno 2] No such file or directory: 'app/static/widgets/calculator.html'

but:

pi@pihole:[~/.local/lib/python3.9/site-packages/app/static/widgets] $ ll

total 20
-rw-r--r-- 1 pi pi 8519 Aug 22 07:14 calculator.html
drwxr-xr-x 2 pi pi 4096 Aug 22 07:14 .
drwxr-xr-x 10 pi pi 4096 Aug 22 07:14 ..
pi@pihole:[~/.local/lib/python3.9/site-packages/app/static/widgets]

Originally created by @un99known99 on GitHub (Sep 2, 2023). Original GitHub issue: https://github.com/benbusby/whoogle-search/issues/1062 Hi, got strange error while performing a search in 0.8.3: return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "/home/pi/.local/lib/python3.9/site-packages/app/routes.py", line 122, in decorated return f(*args, **kwargs) File "/home/pi/.local/lib/python3.9/site-packages/app/routes.py", line 57, in decorated return f(*args, **kwargs) File "/home/pi/.local/lib/python3.9/site-packages/app/routes.py", line 359, in search response = add_calculator_card(html_soup) File "/home/pi/.local/lib/python3.9/site-packages/app/utils/widgets.py", line 51, in add_calculator_card widget_file = open('app/static/widgets/calculator.html') **FileNotFoundError: [Errno 2] No such file or directory: 'app/static/widgets/calculator.html'** but: # pi@pihole:[~/.local/lib/python3.9/site-packages/app/static/widgets] $ ll total 20 -rw-r--r-- 1 pi pi 8519 Aug 22 07:14 calculator.html drwxr-xr-x 2 pi pi 4096 Aug 22 07:14 . drwxr-xr-x 10 pi pi 4096 Aug 22 07:14 .. pi@pihole:[~/.local/lib/python3.9/site-packages/app/static/widgets]
kerem 2026-02-25 20:36:13 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@Moist-Cat commented on GitHub (Sep 9, 2023):

I'm able to reproduce the error starting whoogle in a different directory (parent).

Command: PYTHONPATH=whoogle-search python -m app
Search query: calculator 1 + 2

app/static/widgets/calculator.html
That's a path relative to the root of the directory so starting whoogle from somewhere else (ex. starting the application as a systemd service) will give an error.
I guess I could patch it resolving the path with Path(file) but a global BASE_DIR variable could be better.

<!-- gh-comment-id:1712349417 --> @Moist-Cat commented on GitHub (Sep 9, 2023): I'm able to reproduce the error starting whoogle in a different directory (parent). Command: `PYTHONPATH=whoogle-search python -m app` Search query: calculator 1 + 2 >app/static/widgets/calculator.html That's a path relative to the root of the directory so starting whoogle from somewhere else (ex. starting the application as a systemd service) will give an error. I guess I could patch it resolving the path with Path(__file__) but a global BASE_DIR variable could be better.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/whoogle-search#649
No description provided.