Sublime Forum

ST3 importing from the default plugins

#1

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 :smile:

1 Like

#2

import Default.comment should work just fine. What error are you getting?

1 Like

#3
ImportError: No module named 'Default'

This is what I get.

1 Like

#4

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:

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:

'/Applications/Sublime Text.app/Contents/MacOS', '/Applications/Sublime Text.app/Contents/MacOS/python3.3.zip', '/Users/eric/Library/Application Support/Sublime Text 3/Packages']
1 Like

#5

Hey,

I’m sorry I’m replying so late. I thought I have email notifications for this thread, but I guess I don’t :smile: 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 :smile:
Anyway thanks for the help!

1 Like