nxt_editor icon indicating copy to clipboard operation
nxt_editor copied to clipboard

Prefs dir IOError

Open ImLucasBrown opened this issue 3 years ago • 1 comments

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'

ImLucasBrown avatar Feb 15 '21 13:02 ImLucasBrown

NXT Maya plugin just has to be initialized for this error to happen.

matthew-schiller avatar Feb 15 '21 13:02 matthew-schiller