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

KeyError('Path') exception is being thrown #3

Open
blt-r opened this issue Feb 21, 2023 · 1 comment
Open

KeyError('Path') exception is being thrown #3

blt-r opened this issue Feb 21, 2023 · 1 comment

Comments

@blt-r
Copy link

blt-r commented Feb 21, 2023

If I try to use any command (except for --help), an exception is thrown.

$ mons list
KeyError('Path')
An unhandled exception has occurred.
Use the --debug flag to disable clean exception handling.

$ mons add steam ~/.local/share/Steam/steamapps/common/Celeste
KeyError('Path')
An unhandled exception has occurred.
Use the --debug flag to disable clean exception handling.

I am on Arch Linux and this happens whether I install mons from AUR, pip, or build from saurce.

Full stack trace:

$ mons --debug help
An unhandled exception has occurred.
  File "/home/blt/cood/py/mons/mons/clickExt.py", line 102, in main
    super().main(args=args, *params, **extra)
  File "/home/blt/cood/py/mons/env/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/blt/cood/py/mons/env/lib/python3.10/site-packages/click/core.py", line 1654, in invoke
    super().invoke(ctx)
  File "/home/blt/cood/py/mons/env/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/blt/cood/py/mons/env/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/blt/cood/py/mons/env/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/blt/cood/py/mons/mons/mons.py", line 17, in cli
    ctx.obj = ctx.with_resource(UserInfo())
  File "/home/blt/cood/py/mons/env/lib/python3.10/site-packages/click/core.py", line 571, in with_resource
    return self._exit_stack.enter_context(context_manager)
  File "/usr/lib/python3.10/contextlib.py", line 492, in enter_context
    result = _cm_type.__enter__(cm)
  File "/home/blt/cood/py/mons/mons/config.py", line 78, in __enter__
    self.installs = {name: load_install(name) for name in installs.sections()}
  File "/home/blt/cood/py/mons/mons/config.py", line 78, in <dictcomp>
    self.installs = {name: load_install(name) for name in installs.sections()}
  File "/home/blt/cood/py/mons/mons/config.py", line 75, in load_install
    name, installs[name]["Path"], cache=cache[name], data=installs[name]
  File "/usr/lib/python3.10/configparser.py", line 1258, in __getitem__
    raise KeyError(key)
KeyError: 'Path'
@blt-r
Copy link
Author

blt-r commented Feb 21, 2023

The problem was that I had this in my installs.ini:

[DEFAULT]
preferredbranch = stable

[steam-flatpak]

I had previously used steam flatpak, but now I am using native package. I guess at some point it saw that the path I specified for the installation didn't exist and tried to remove the installation, but didn't remove the entry for it, instead only removing the path field. And then tried to access that field, which caused the exception.

Fixing the corrupt config file solved the issue

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