web2py / py4web

Other
242 stars 124 forks source link

url_prefix option gives ERROR with _default app #894

Open nicozanf opened 1 month ago

nicozanf commented 1 month ago

It gives "IndexError: string index out of range". It occurs on the _default app only.

With the command:

./py4web.py run apps -U /dev

[....]

[ ] loading _default ... [2024-07-16T22:50:52.658092]: Traceback (most recent call last): File "/home/nico/py4web/py4web/core.py", line 1430, in import_app module = load_module(module_name, init) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/nico/py4web/py4web/core.py", line 157, in load_module spec.loader.exec_module(module) File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/home/nico/py4web/apps/_default/init.py", line 5, in @action("index") ^^^^^^^^^^^^^^^ File "/home/nico/py4web/py4web/core.py", line 1082, in call Reloader.register_route(app_name, short_path, self.kwargs, func) File "/home/nico/py4web/py4web/core.py", line 1485, in register_route bottle.route(rule, **kwargs)(dec_func) File "/home/nico/py4web/venv/lib/python3.12/site-packages/ombott/ombott.py", line 138, in decorator self.add_route(rule, method, callback, name, overwrite=overwrite) File "/home/nico/py4web/venv/lib/python3.12/site-packages/ombott/ombott.py", line 130, in add_route return self.router.add(rule, method, handler, name, overwrite=overwrite) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/nico/py4web/venv/lib/python3.12/site-packages/ombott/router/radirouter.py", line 240, in add return self._add(rule, methods, handler, name, meta=meta, overwrite=overwrite) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/nico/py4web/venv/lib/python3.12/site-packages/ombott/router/radirouter.py", line 375, in _add route = Route(rule) ^^^^^^^^^^^ File "/home/nico/py4web/venv/lib/python3.12/site-packages/ombott/router/radirouter.py", line 55, in init pattern, params, filters, pattern_out, filters_out = self.class.parse_rule(rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/nico/py4web/venv/lib/python3.12/site-packages/ombott/router/radirouter.py", line 177, in parse_rule assert rule[0] == '/'


IndexError: string index out of range
[FAILED] loading _default (string index out of range)
[X] loaded _documentation       
Dashboard is at: http://127.0.0.1:8000/_dashboard
Ombott v2.0 server starting up (using <class 'py4web.server_adapters.rocketServer.<locals>.RocketServer'>(reloader=False, logging_level=30))...
Listening on http://127.0.0.1:8000/
Hit Ctrl-C to quit.
nicozanf commented 1 month ago

Strangely, using --url-prefix=/dev gives exactly the same error, while -U=/dev gives a lot more errors (with click module, also) and py4web does not even start