Home Download Buy Blog Forum Support

ST3 importing from the default plugins

ST3 importing from the default plugins

Postby zbrox on Mon Apr 15, 2013 8:41 pm

Hey,

I'm trying to figure out how to import the 'Default' module, which is available in the application bundle in Mac OS X. I saw that in ST3 I can just use 'import Default.comment', but I've tried it to no avail. I also tried the dot notation even though the module is not in the same folder as the plugin I'm writing.

Any help would be appreciated :)
zbrox
 
Posts: 3
Joined: Mon Apr 15, 2013 8:36 pm

Re: ST3 importing from the default plugins

Postby sapphirehamster on Tue Apr 16, 2013 8:12 pm

Code: Select all
import Default.comment
should work just fine. What error are you getting?
sapphirehamster
 
Posts: 83
Joined: Sun Jul 01, 2012 11:19 pm

Re: ST3 importing from the default plugins

Postby zbrox on Fri Apr 19, 2013 2:28 pm

Code: Select all
ImportError: No module named 'Default'


This is what I get.
zbrox
 
Posts: 3
Joined: Mon Apr 15, 2013 8:36 pm

Re: ST3 importing from the default plugins

Postby sapphirehamster on Fri Apr 19, 2013 8:24 pm

Hm. There must be some issue with your installation. I assume you are saving your plugin somewhere like ~/Library/Application Support/Sublime Text 3/Packages/User. I'm using build 3028. Try making a plugin that will print the Python path to see if anything looks fishy, like:

Code: Select all
import sublime, sublime_plugin
#import Default.comment
import sys

class ExampleCommand(sublime_plugin.TextCommand):
   def run(self, edit):
      #print(dir(Default.comment))
      print(sys.path)


This prints the following for me:

Code: Select all
['/Applications/Sublime Text.app/Contents/MacOS', '/Applications/Sublime Text.app/Contents/MacOS/python3.3.zip', '/Users/eric/Library/Application Support/Sublime Text 3/Packages']
sapphirehamster
 
Posts: 83
Joined: Sun Jul 01, 2012 11:19 pm

Re: ST3 importing from the default plugins

Postby zbrox on Sat Jun 01, 2013 2:22 pm

Hey,

I'm sorry I'm replying so late. I thought I have email notifications for this thread, but I guess I don't :) I put the provided code as a plugin in the path you mentioned. However I don't see any output in the console. I'm not sure I have the entire picture and the documentation about plugin creation is really scarce. Half of the things are just educated guesses that I'm making :)
Anyway thanks for the help!
zbrox
 
Posts: 3
Joined: Mon Apr 15, 2013 8:36 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 2 guests