In my case I am using Pygments in my plugin.
So I have Packages\Pygmentize as my package with pygmentize.py and Pygmentize.package-menu in this directoy and the pygments main module directory as well.
In my pygmentize.py file I do:
[code]from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import get_formatter_by_name
import sublime
import sublimeplugin
class DoPygmentize(sublimeplugin.TextCommand):
def run(self, view, args):
formatter = view.options().getString(‘pygmentsFormatter’) or u’html’
formatter = get_formatter_by_name(formatter)
…[/code]
When I run this from the plugin I get:
Traceback (most recent call last):
File ".\sublimeplugin.py", line 119, in execTextCommand
File ".\pygmentize.py", line 20, in run
File ".\pygments\formatters\__init__.py", line 51, in get_formatter_by_name
File ".\pygments\formatters\html.py", line 341, in __init__
File ".\pygments\formatter.py", line 67, in __init__
File ".\pygments\formatter.py", line 22, in _lookup_style
File ".\pygments\styles\__init__.py", line 55, in get_style_by_name
pygments.util.ClassNotFound: Could not find style module 'default', though it should be builtin.
This is despite every subdirectory having an init.py.
The part leading up to this in styles_init_.py:
try:
mod = __import__('pygments.styles.' + mod, None, None, [cls])
except ImportError:
raise ClassNotFound("Could not find style module %r" % mod +
(builtin and ", though it should be builtin") + ".")