Sublime Forum

Import problem in plugin

#1

Hello,

I am new to sublime plugin development (and not very versed in python as well).
When I create a simple plugin and put it into my Packages/User directory, sublime loads it and it runs fine.

However, when I create a new directory inside Packages folder and put it there, sublime complains:

reloading python 3.3 plugin ArgoLogFormatter.ArgoLogFormatter
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 306, in reload_plugin
    m = imp.reload(m)
  File "./python3.3/imp.py", line 276, in reload
  File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1022, in load_module
  File "<frozen importlib._bootstrap>", line 1003, in load_module
  File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 868, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "/Users/nenad/Library/Application Support/Sublime Text/Packages/ArgoLogFormatter/ArgoLogFormatter.py", line 2, in <module>
    from json import JSONDecodeError
ImportError: cannot import name JSONDecodeError

The name of the directory is the same as the name of the plugin file.

0 Likes

#2

https://stackoverflow.com/questions/44714046/python3-unable-to-import-jsondecodeerror-from-json-decoder

Plugins by default use python 3.3, see https://www.sublimetext.com/docs/api_environments.html

1 Like

#3

Oh, the environments use different Python versions, well, I did not expect that :slight_smile: Thanks!

0 Likes