Задать вопрос
  • TypeError: __init__() takes 1 positional argument but 2 were given у меня проект на aiogram плюс sqlalhemy ,но я совсем недавно начал?

    @nevergodmode Автор вопроса
    Aragorn, TypeError: __init__() takes 1 positional argument but 2 were given
    Traceback (most recent call last):
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\dispatcher.py", line 309, in _process_update
    response = await self.feed_update(bot, update, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\dispatcher.py", line 158, in feed_update
    response = await self.update.wrap_outer_middleware(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\middlewares\error.py", line 25, in __call__
    return await handler(event, data)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\middlewares\user_context.py", line 56, in __call__
    return await handler(event, data)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\fsm\middleware.py", line 42, in __call__
    return await handler(event, data)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\event\telegram.py", line 121, in trigger
    return await wrapped_inner(event, kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\event\handler.py", line 43, in call
    return await wrapped()
    ^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\dispatcher.py", line 276, in _listen_update
    return await self.propagate_event(update_type=update_type, event=event, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\router.py", line 142, in propagate_event
    return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\router.py", line 137, in _wrapped
    return await self._propagate_event(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\router.py", line 170, in _propagate_event
    response = await router.propagate_event(update_type=update_type, event=event, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\router.py", line 142, in propagate_event
    return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\router.py", line 137, in _wrapped
    return await self._propagate_event(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\router.py", line 162, in _propagate_event
    response = await observer.trigger(event, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\event\telegram.py", line 121, in trigger
    return await wrapped_inner(event, kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\egora\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiogram\dispatcher\event\handler.py", line 43, in call
    return await wrapped()
    ^^^^^^^^^^^^^^^
    File "C:\Users\egora\Documents\SHOPBOT\app\handler.py", line 15, in start
    await rq.set_user(message.from_user.id)
    File "C:\Users\egora\Documents\SHOPBOT\app\database\requests.py", line 10, in set_user
    session.add(User(tg_id == tg_id))
    ^^^^^^^^^^^^^^^^^^^^
    TypeError: __init__() takes 1 positional argument but 2 were given
    Написано