Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
un99known99 opened this issue Sep 2, 2023 · 1 comment · Fixed by #1064
Labels
bug Something isn't working

Comments

@un99known99
Copy link

un99known99 commented Sep 2, 2023

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]

@un99known99 un99known99 added the bug Something isn't working label Sep 2, 2023
@Moist-Cat
Copy link
Contributor

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.

Moist-Cat added a commit to Moist-Cat/whoogle-search that referenced this issue Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants