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

Error when running Pacu as CLI command and --session flag #351

Closed
DaveYesland opened this issue May 11, 2023 · 0 comments
Closed

Error when running Pacu as CLI command and --session flag #351

DaveYesland opened this issue May 11, 2023 · 0 comments

Comments

@DaveYesland
Copy link
Collaborator

The following error is porduced when trying to run Pacu as a CLI command using the --session flag.
This should activate the specified session but instead can error out because it activates multiple sessions if the command has been run previously.

Traceback (most recent call last):
  File "/home/rhino/.local/bin/pacu", line 8, in <module>
    sys.exit(main())
  File "/home/rhino/.local/lib/python3.9/site-packages/pacu/__main__.py", line 10, in main
    pacu.Main().run()
  File "/home/rhino/.local/lib/python3.9/site-packages/pacu/main.py", line 1955, in run
    self.run_cli(args)
  File "/home/rhino/.local/lib/python3.9/site-packages/pacu/main.py", line 1792, in run_cli
    self.exec_module(module)
  File "/home/rhino/.local/lib/python3.9/site-packages/pacu/main.py", line 1051, in exec_module
    session = self.get_active_session()
  File "/home/rhino/.local/lib/python3.9/site-packages/pacu/main.py", line 592, in get_active_session
    return PacuSession.get_active_session(self.database)
  File "/home/rhino/.local/lib/python3.9/site-packages/pacu/core/models.py", line 157, in get_active_session
    return database.query(PacuSession).filter(PacuSession.is_active == True).scalar()  # noqa: E712
  File "/home/rhino/.local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3523, in scalar
    ret = self.one()
  File "/home/rhino/.local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3492, in one
    util.raise_(
  File "/home/rhino/.local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
sqlalchemy.orm.exc.MultipleResultsFound: Multiple rows were found for one()
Traceback (most recent call last):
  File "/home/rhino/.local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3490, in one
    ret = self.one_or_none()
  File "/home/rhino/.local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3467, in one_or_none
    raise orm_exc.MultipleResultsFound(
sqlalchemy.orm.exc.MultipleResultsFound: Multiple rows were found for one_or_none()
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