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

Removing database throws error #235

Closed
dgdekoning opened this issue May 8, 2019 · 1 comment · Fixed by #242
Closed

Removing database throws error #235

dgdekoning opened this issue May 8, 2019 · 1 comment · Fixed by #242

Comments

@dgdekoning
Copy link
Contributor

My suggestion in #234 to remove the databases can't be done from inside the activity-browser as trying to delete a database throws the error:

Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Continuum\miniconda3\envs\ab\lib\site-packages\activity_browser\app\controller.py", line 261, in delete_database
    project_settings.remove_db(name)
  File "C:\Users\user\AppData\Local\Continuum\miniconda3\envs\ab\lib\site-packages\activity_browser\app\settings.py", line 123, in remove_db
    self.settings['read-only-databases'].pop(db_name, None)
KeyError: 'read-only-databases'

According to @bsteubing this is similar to issue #194 and its linked pull-request #199

@dgdekoning
Copy link
Contributor Author

Looking deeper into the code, it looks like the 'read-only-databases' key is never stored when a project is created:

# From activity_browser/app/settings.py lines 78 through 84
if os.path.isfile(self.settings_file):
    self.load_settings()
else:
    # make empty dict for settings
    self.settings = {}
    # save to ensure it's always accessible after first project select
    self.write_settings()

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

Successfully merging a pull request may close this issue.

1 participant