Sublime Forum

Overriding installed package's file logs ImportError and fails

#1

hello,

I’m hoping to override some file in some Package Control -installed package on my system. I don’t know that the specifics are relevant, and I also hope to come away with more generalizable info I can hopefully use to do the same thing seamlessly with other packages in the future, but the package I’m messing with currently is SublimeLinter, the most recent version, and I’m on Sublime 4143, on Windows.

I found instructions detailing how to override an installed package on a per-file basis and I followed them correctly. The instructions told me to create a top-level folder inside my Packages folder named after the installed package, including the “sublime-package” extension, so that’s what I did. I have the intended override file, placed inside this folder in a position in the folder’s hierarchy that is equal to its position in the installed package – specifically, top-level. It’s named the same thing as the original file.

this is what I see in Sublime’s console output:

reloading python 3.3 plugin SublimeLinter.sublime-package.highlight_view
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text\Lib\python33\sublime_plugin.py", line 308, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1512, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1529, in _find_and_load_unlocked
ImportError: No module named 'SublimeLinter.sublime-package'

does anyone more knowledgeable than me have any steps I could take to try and troubleshoot this thing? I’ve already uninstalled and reinstalled the package, and also restarted Sublime Text, a couple of times. Thanks for reading, I appreciate any help I can get.

0 Likes

#2

The folder that you create in Packages has to be named the same as the package file, but it should not have the sublime-package portion of the name.

Packages/Bob and Installed Packages/Bob.sublime-package both refer to the package named Bob, with the contents of the folder overriding the same named file in the sublime-package file.

The OverrideAudit package has a command in the command palette, OverideAudit: Create Override that will prompt you for the resource and then do all the work for you, so that you just need to modify the file content and save to put it into place.

It also has the ability to warn you when your override is out of date and possibly may cause you issues.

0 Likes

#3

thanks for the reply. Since posting the OP I’ve experimented a bit more and found I could override individual files of a different package by doing as you said. I could’ve sworn I initially tried the same thing with the SublimeLinter file and it failed to work as expected, and that this was the entire reason I sought out the further instructions that turned out to be wrong and produce my error, but after seeing your reply, I tested the thing on SublimeLinter in the way you describe and, surprise, it works just fine. No idea what explains my experiences, but hey, I appreciate your helping me out very much.

1 Like