bottle icon indicating copy to clipboard operation
bottle copied to clipboard

Reload=True fails when run from a venv module

Open pdc1 opened this issue 5 months ago • 0 comments

Hello,

I have an app with a root-level app.py that does run(...) if __name__ == "__main__". So far so good.

I recently moved app.py into the app module so it was included in the packaging, but now the development-level run(...) doesn't work if reloader=True.

I am using poetry, so the app is running in a venv, if that matters.

> py -m libsearch.app
Running Bottle app in development mode
Routes registered: [<GET / -> libsearch.views:search_form>, <GET /tailwind.css -> libsearch.views:get_css>, <POST /results -> libsearch.views:search>]
[...]\pypoetry\Cache\virtualenvs\libsearch-vAUISaff-py3.11\Scripts\python.exe: No module named libsearch.__main__; 'libsearch' is a package and cannot be directly executed

If I set reloader=False it works as expected. There are easy workarounds (use the root-level app.py or set reloader=False) but this sure took a long time to debug!

pdc1 avatar Aug 11 '25 14:08 pdc1