Sublime Forum

Python Plugins Not Loading?

#1

I’ve had a couple of reports that I’ve not been able to replicate of OS X users having plugins not loading properly. A few people have had trouble with the Alignment plugin, and had to open the Alignment.py file and re-save it to get it to work.

I’ve also experienced this with the SFTP plugin, however I do not distribute the raw source in order to preserve the ability to license it, so only the .pyc files are included. I’m working on the exact same version of OS X and Sublime and for some reason I currently have two users who see all menu entries, just disabled. I’ve seen this before if the python contains an error that prevents loading the relevant command classes.

There are no errors in the console, the init.py script it being listed as loaded, yet the python command classes appear not to be loading. Completely removing and reinstalling the package has no effect. I even refactored the whole plugin from a single .py file into a directory of around 20 .py files. The .pyc files are all present on both machines, and of the same size.

Anyone have ideas about what could be going on, or ideas to try? I’ve tried installing all of the other packages the users had to see if it was some sort of conflict, but I was unable to find anything.

0 Likes

#2

OS X is the only platform where the system version of Python is used, however some users tweak their system so that doesn’t work properly: I’ve seen people overwrite the default version with the macports version, delete the 64 bit version, or delete the 2.6 version. I doubt it’s something as drastic as this going on, but it could be that the systems Python version has been compromised in some way.

If you’re seeing this locally, you can add some debug logging into sublime_plugin.py (in the Sublime Text 2 application bundle), in the functions create_xxx_commands, and reload_plugin.

0 Likes

#3

I have determined that the python imaging library (PIL) is causing the issue. Users who were having trouble were able to fix it by removing PIL from /Library/Python/2.6/site-packages/. I’m currently in the process of installing PIL to see if I can figure out why a package in the python path would cause a whole Sublime plugin to not load, especially without any errors!

0 Likes

#4

It appears that sublime_plugin.py uses import() to load *.py files from packages. If a package *.py file has the same name as a file in one of the directories in sys.path, the .py file from the sys.path directory will be reflected. When this happens, no command classes will be found, and your menu items will all appear and be disabled since there are no is_visible() methods. :smile:

I sent a patch over to Jon related to this.

0 Likes