nxt_editor
nxt_editor copied to clipboard
Prefs dir IOError
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:
- Start NXT
- Rename or delete the prefs dir
- Attempt to change the state of a pref like
Node Tooltips
- 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'
NXT Maya plugin just has to be initialized for this error to happen.