Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 missing 1 required positional argument error
#1
I'm receiving the following error:

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:
@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?
Quote
#2
Where is pymydb supposed to come from?
I'm not super-familiar with bottle, but in most frameworks which use route decorators, arguments are provided by the decorator when using an appropriately-formatted route path.
Quote
#3
pymydb comes from these lines in the top of myscript.

plugin = bottle_pymysql.Plugin( dbuser='nikos', dbpass='trustno1bm3$', dbname='clientele', dictrows=False )
app.install(plugin)
That is in the top of my script after the imports and NOT within the view function in case it matters.

i have 2 scripts with '/' routes and they both use the parameter 'pymydb'

@app.route( '/' ) 
@app.route( '/<page>' ) 
def index( pymydb, page='index.html' ):
this one works without an error, so it seems it can find pymydb

while in my other script

@app.route( '/' )
@auth_basic(counters.is_authenticated_user)
def listall( pymydb ):
is giving the error i posted.

i just noticed that if i remove the:

@auth_basic(counters.is_authenticated_user)
then the script work without giving me an error!

But why is that?
Quote
#4
Hello, can someone help me with this please?

This route works as expected

@app.route( '/download', method=['GET', 'POST'] )
def download( pymydb ):
while the following, in which iam trying with http auth

@app.route( '/download', method=['GET', 'POST'] )
@auth_basic(counters.is_authenticated_user)
def download( pymydb ):
fails by giving me the error

Error:
TypeError("download() missing 1 required positional argument: 'pymydb'",) Traceback: 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: download() missing 1 required positional argument: 'pymydb'
Why is that? How will i be able to enable http auth in this route?
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Syntax Error with Argument Parser aditya_man 1 189 Sep-30-2019, 01:21 PM
Last Post: ichabod801
  authentication required error with urlopen Ranjirock 2 187 Sep-11-2019, 01:01 PM
Last Post: Ranjirock
  Invalid argument error thrown. pyseeker 4 585 Sep-10-2019, 07:03 PM
Last Post: pyseeker
  Missing required dependencies when using pyinstaller Ghonim 15 4,003 Jul-15-2019, 08:47 AM
Last Post: shubhthkr
  Type error: dump() missing 1 required positional argument: fp jaycuff13 2 1,550 Jul-13-2019, 10:21 AM
Last Post: jaycuff13
  missing 1 required positional argument: psosmol 7 3,650 Apr-16-2019, 10:07 AM
Last Post: DeaD_EyE
  Missing 2 Required Positional Arguments: SwiftWater 1 4,517 Feb-28-2019, 08:57 AM
Last Post: buran
  go_to() missing 1 required positional argument: 'url' HMAeymo 1 1,636 Aug-15-2018, 08:38 PM
Last Post: micseydel
  TypeError: exitfunc() missing 1 required positional argument: 'self' venkateshrathod 3 8,449 Apr-29-2018, 09:39 AM
Last Post: Larz60+
  TypeError: get_formatted_name() missing 1 required positional argument: 'last_name' tjnichols 4 23,841 Mar-28-2018, 07:38 PM
Last Post: buran

Forum Jump:


Users browsing this thread: 1 Guest(s)