Skip to content

Prefs dir IOError #168

Open
Open
@ImLucasBrown

Description

@ImLucasBrown

Describe the bug
If the prefs dir is removed while NXT is open, the pref object raises an IOError when it attempts to write a default pref value.

To Reproduce
Steps to reproduce the behavior:

  1. Start NXT
  2. Rename or delete the prefs dir
  3. Attempt to change the state of a pref like Node Tooltips
  4. Exception raised

Expected behavior
Gracefully handle missing pref dir after the app is running

Desktop (please complete the following information):

  • Version Editor v3.7.0

Additional context

Traceback (most recent call last):
  File "nxt_demo_py3\lib\site-packages\nxt_editor\actions.py", line 1336, in toggle_tooltip
    user_dir.user_prefs[pref_key] = tooltip_state
  File "nxt_demo_py3\lib\site-packages\nxt_editor\user_dir.py", line 139, in __setitem__
    self.write()
  File "nxt_demo_py3\lib\site-packages\nxt_editor\user_dir.py", line 167, in write
    with open(self.path, 'w+') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Lucas\\nxt\\prefs\\3\\prefs.json'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions