missing 1 required positional argument error

vergos.nikolas at gmail.com vergos.nikolas at gmail.com
Tue Feb 26 10:54:41 EST 2019


Τη Τρίτη, 26 Φεβρουαρίου 2019 - 5:21:14 μ.μ. UTC+2, ο χρήστης Calvin Spealman έγραψε:
> you call it by visiting the route you've mapped to it, so when you run this
> app and navigate to the root / URL it gets called. What do you expect this
> parameter to be and where did you expect it to come from when you wrote the
> listall() function?
> 
> On Tue, Feb 26, 2019 at 10:15 AM <vergos.nikolas at gmail.com> wrote:
> 
> > I'm receiving the following error:
> >
> > Traceback (most recent call last):
> >   File "/usr/lib64/python3.6/site-packages/bottle.py", line 862, in _handle
> >     return route.call(**args)
> >   File "/usr/lib64/python3.6/site-packages/bottle.py", line 1740, in
> > wrapper
> >     rv = callback(*a, **ka)
> >   File "/usr/lib64/python3.6/site-packages/bottle.py", line 2690, in
> > wrapper
> >     return func(*a, **ka)
> > TypeError: listall() missing 1 required positional argument: 'pymydb'
> >
> > and this is my route definition:
> >
> > @app.route( '/' )
> > @auth_basic(counters.is_authenticated_user)
> > def listall( pymydb ):
> >
> > The way i understand this error is that i'am trying to call 'listall()'
> > without giving it an argument while in its definition i do have 'pymydb' as
> > a parameter.
> >
> > BUT from inside my script i do NOT call listall at all, so how can it miss
> > an argument?

Yes, '/' route is being called when i visir it with my browser. Ok, but that function needs to work with the 'pymydb' 'bottle-pymysql' keyword so it must have it as a parameter.

In another script of mine i have mapped '/' to def index( pymydb ) and its working without error. How come it works there and not work here?

They are both '/' routes.



More information about the Python-list mailing list