mila-iqia/paperoni

TypeError: app.<locals>.regen() got an unexpected keyword argument 'db' in /author-institution/

Opened this issue · 0 comments

This :

async def regenerator(queue, regen, reset, db):
gen = regen(db=db)

throws the following exception :

> Traceback (most recent call last):
>   File "/Users/satyaortiz-gagne/travail/mila/CODE/paperoni-config/venv/cp311/lib/python3.11/site-packages/starbear/serve.py", line 278, in run
>     await self.fn(self.page)
>   File "/Users/satyaortiz-gagne/travail/mila/CODE/paperoni-config/venv/cp311/lib/python3.11/site-packages/starbear/wrap.py", line 33, in wrapped_app
>     await app(page)
>   File "/Users/satyaortiz-gagne/travail/mila/CODE/paperoni/paperoni/webapp/common.py", line 276, in app
>     return await fn(page, page[target])
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/Users/satyaortiz-gagne/travail/mila/CODE/paperoni/paperoni/webapp/author-institution.py", line 240, in app
>     async for result in regen:
>   File "/Users/satyaortiz-gagne/travail/mila/CODE/paperoni/paperoni/webapp/common.py", line 186, in regenerator
>     gen = regen(db=db)
>           ^^^^^^^^^^^^
> TypeError: app.<locals>.regen() got an unexpected keyword argument 'db'

The definition of regen is :

def regen(event=None):
name = None
if event is not None:
name = event["name"]
if event is not None and event["$submit"] == True:
name = None
addAuthor(event)
return generate(name)

and the previous call in stack is :

with load_config(os.environ["PAPERONI_CONFIG"]) as cfg:
with cfg.database as db:
regen = regenerator(
queue=q,
regen=regen,
reset=page["#mid-div"].clear,
db=db,
)
async for result in regen:
htmlAuthor(result)

I'll check the history for the file and try to understand what could have leaded to this