WHY it compains about the missing argument is WHAT i don't understand

dieter dieter at handshake.de
Wed Oct 9 00:52:07 EDT 2019


Νίκος Βέργος <vergos.nikolas at gmail.com> writes:
> plugin = bottle_pymysql.Plugin( dbuser='user', dbpass='pass', dbname='counters', dictrows=False )
> app.install(plugin)
>
> .......
> .......
>
> @app.route( '/' )
> @auth_basic( counters.is_authenticated_user )
> def listall( pymydb ):
              ^^^^^^^^

This declares `listall` to have one mandatory positional argument
"pymydb".

> But when i try to load the app's URL like  http://superhost.gr/clientele as you can see i get this error:
>
>
> Exception:
> TypeError("listall() missing 1 required positional argument: 'pymydb'",)
> Traceback:
> Traceback (most recent call last):
>   File "/usr/lib/python3.6/site-packages/bottle.py", line 862, in _handle
>     return route.call(**args)
>   File "/usr/lib/python3.6/site-packages/bottle.py", line 1740, in wrapper
>     rv = callback(*a, **ka)
>   File "/usr/lib/python3.6/site-packages/bottle.py", line 2690, in wrapper
>     return func(*a, **ka)
> TypeError: listall() missing 1 required positional argument: 'pymydb'

This error indicates that `listall` is called by the `bottle` function
wrapper without positional argument.

> listall() is `/` route's callback function and i never inside my script i call  listall( pymydb ).
> Why it compains about the missing argument is WHAT i don't understand.

Your definition of `listall` does not match the expectations
of `bottle` with regard to this function.
Reread the corresponding documentation and adapt your `listall`.




More information about the Python-list mailing list