pykong / WrapIt

Sublime Text 3 Plugin to Wrap Contents With Specific Code.
MIT License
4 stars 0 forks source link

[Bug] TypeError: 'NoneType' object is not iterable #2

Open Kristinita opened 6 years ago

Kristinita commented 6 years ago

1. Summary

WrapIt doesn't work for me after Sublime Text restarting.

2. Environment

3. Steps to reproduce

I reproduce the problem in a version of Sublime Text without plugins and user settings. I reproduce the problem in default Python and PythonImproved syntaxes.

I have a file SashaExample.py, it content:

print("Sasha Goddess!")

I install WrapIt via Sublime → I select print("Sasha Goddess!")Ctrl+Shift+P (⌘⇧p for Mac) → WrapIt: Choose Wrapper.

4. Expected behavior

WrapIt menu:

WrapIt menu

5. Actual behavior

If I restart Sublime Text after installation WrapIt:

key evt: alt+w
command: wrap_it_menu
Traceback (most recent call last):
  File "D:\Sublime Text 3 x64\sublime_plugin.py", line 797, in run_
    return self.run()
  File "wrap_it in D:\Sublime Text 3 x64\Data\Installed Packages\WrapIt.sublime-package", line 47, in run
  File "wrap_it in D:\Sublime Text 3 x64\Data\Installed Packages\WrapIt.sublime-package", line 14, in detect_syntax
TypeError: 'NoneType' object is not iterable

Thanks.

thrbn commented 6 years ago

I managed to fix it. The plugin tries to load its settings when it does not have access to them yet. I am new to github, so I have no idea on how pull requests work. @pykong You can either take a look at sublimes 'plugin_loaded()' method or move the load_settings() lines into the detect_syntax method Other than that: Very cool plugin. It is helping me a lot.