Home Download Buy Blog Forum Support

ImportError: No module named sublimeplugin

ImportError: No module named sublimeplugin

Postby isfinite on Sat Jan 29, 2011 10:05 pm

I just installed the Mac OSX Alpha and wanted to get started trying to write a plugin but i'm getting this error in my console whenever I save anything after importing sublimeplugin
"ImportError: No module named sublimeplugin"

Here are the contents of my file I'm doing just to test things out:
Code: Select all
import sublime, sublimeplugin

print "plugin loaded"

class Test1Command(sublimeplugin.TextCommand):
   def run(self, view, args):
      print "command run"



Any ideas on what I may be doing wrong or missing?
isfinite
 
Posts: 5
Joined: Sat Jan 29, 2011 10:02 pm

Re: ImportError: No module named sublimeplugin

Postby guillermooo on Sat Jan 29, 2011 10:11 pm

I Sublime 2, the new name's "sublime_plugin". That should work.
Vintageous (Vim emulation) • SublimeHg
guillermooo
 
Posts: 697
Joined: Thu Jul 23, 2009 9:06 am

Re: ImportError: No module named sublimeplugin

Postby isfinite on Sat Jan 29, 2011 10:22 pm

that works perfectly now, thanks!

one more question, did
Code: Select all
view.runCommand('test1')
change? that's the way the API docs specify to run it but i'm getting an AttributeError.
isfinite
 
Posts: 5
Joined: Sat Jan 29, 2011 10:02 pm

Re: ImportError: No module named sublimeplugin

Postby guillermooo on Sat Jan 29, 2011 10:28 pm

The api docs cover good old Sublime 1.x... Sublime 2 introduces a few changes to how the api works and looks... Most prominently, Sublime 2 api conforms to PEP8, which means camelCase becomes camel_case. However, your best bet is to dir() whatever object you're interested in in the python console (CTRL + ~) and try to find the new names. The old docs are still valid to a great extent, but new ones are badly needed.
Vintageous (Vim emulation) • SublimeHg
guillermooo
 
Posts: 697
Joined: Thu Jul 23, 2009 9:06 am

Re: ImportError: No module named sublimeplugin

Postby isfinite on Sat Jan 29, 2011 10:53 pm

Ah, I see now. Well last question I promise =)

Is there a list around somewhere of good plugins that can be run on Sublime 2 that I could use as an example to look at?

Thanks again for all the help. Much appreciated.
isfinite
 
Posts: 5
Joined: Sat Jan 29, 2011 10:02 pm

Re: ImportError: No module named sublimeplugin

Postby adzenith on Sat Jan 29, 2011 10:58 pm

Sublime Text 2 has only recently been released, and the API is still a little incomplete, so there aren't a lot of plugins for it yet.
If you check out http://sublimetext.info/, you can see a bunch of plugins for ST1, though, and most of the calls are identical in the way that Guillermo summarized.
Feel free to keep asking questions here if you have them, though. :)
adzenith
 
Posts: 834
Joined: Mon Oct 19, 2009 9:12 pm

Re: ImportError: No module named sublimeplugin

Postby jps on Sat Jan 29, 2011 11:08 pm

For example Sublime Text 2 plugins, you can have a look at the ones that ship with the editor, in the Packages/Default directory (accessible via Preferences/Browse Packages)
jps
Site Admin
 
Posts: 2947
Joined: Wed Mar 19, 2008 12:33 pm

Re: ImportError: No module named sublimeplugin

Postby isfinite on Sun Jan 30, 2011 12:53 am

exactly what i needed. thanks!
isfinite
 
Posts: 5
Joined: Sat Jan 29, 2011 10:02 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 1 guest