Sublime Forum

Where is the "sublime" module?

#1

When develop the sublime plugin,I always use the sublime module。such as:

[code]import sublime, sublime_plugin

class ExampleCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.insert(edit, 0, “Hello, World!”)
[/code]
But I can‘t find the sublime module in my computer. Other module such as sys,os and so on, are easy to find.
I want to know where is the sublime.py module?

1 Like

#2

I believe it’s packaged with the executable file. On windows I see it in the programs/Sublime folder, but I cannot say where to find it on OS X or Linux. I have never looked at the version on my wife’s mac :blush:

You will also find the sublime_plugin module there as well.

0 Likes

#3

It should be in the location as the executable, so from the console enter:

>>> sublime.executable_path() '/Applications/Sublime Text.app/Contents/MacOS/Sublime Text'

You should find the sublime module there. I believe this works for all platforms.

0 Likes

#4

[quote=“facelessuser”]It should be in the location as the executable, so from the console enter:

>>> sublime.executable_path() '/Applications/Sublime Text.app/Contents/MacOS/Sublime Text'

You should find the sublime module there. I believe this works for all platforms.[/quote]

My platform is win7.The result is:

>>> sublime.executable_path() Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'module' object has no attribute 'executable_path'

0 Likes

#5

thank you.

0 Likes

#6

[quote=“lsj8924”]

[quote=“facelessuser”]It should be in the location as the executable, so from the console enter:

>>> sublime.executable_path() '/Applications/Sublime Text.app/Contents/MacOS/Sublime Text'

You should find the sublime module there. I believe this works for all platforms.[/quote]

My platform is win7.The result is:

>>> sublime.executable_path() Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'module' object has no attribute 'executable_path'[/quote]

There is something wrong with you ST installation then, I’m under win7 too and I get this:

>>> sublime.executable_path()
'C:\\Program Files\\Sublime Text 3\\sublime_text.exe'

Is your ST the portable version?

0 Likes

#7

I don’t believe sublime.executable_path() exists for ST2.

0 Likes

#8

Well sir, you have a point…so, upgrade to ST3 :smile:? You will be glad you did.

I guess, the point is, the sublime module is found with the SublimeText binary. So find that, and you find the module.

0 Likes

#9

Neither does sublime.py. It was previously provided internally, just like the sublime_api module now which is used to by the sublime module to forward the calls.

0 Likes