Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
satyaog opened this issue Sep 27, 2023 · 0 comments

Comments

@satyaog
Copy link
Member

satyaog commented Sep 27, 2023

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

@satyaog satyaog changed the title TypeError: app.<locals>.regen() got an unexpected keyword argument 'db' TypeError: app.<locals>.regen() got an unexpected keyword argument 'db' in /author-institution/ Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant