the basic structure of my plugin and jsbeautifier is as follows:
- Code: Select all
JsFormat
> Default (Linux).sublime-keymap
> js_formatter.py
> jsbeautifier
>> __init__.py (not empty)
>> tests
>>> __init__.py
>> unpackers
>>> __init__.py (not empty)
js_formatter.py contains the sublime textcommand for my plugin, which imports and runs jsbeautifier. jsbeautifier/__init__.py attempts to 'import jsbeautifier.unpackers', which fails, and is the real problem. The import fails on jsbeautifier/__init__.py line 255. If I fire up a python repl from the root of the plugin directory importing jsbeautifier or jsbeautifier.unpackers works as expected.
I have tried changing the import logic of my plugin as follows, but it has not resolved the problem:
- Code: Select all
import sublime, sublime_plugin, re, sys, os
directory = os.path.dirname(os.path.realpath(__file__)) + "\\"
jsb_unpackers = directory+"\\jsbeautifier\\unpackers\\"
sys.path.append(jsb_unpackers)
import jsbeautifier
Any suggestions?