4

Sublime Text has a console which can be activated by using Ctrl + `. It exposes a python interpreter. On my machine, it's python 3.3.

>>> import sys
>>> sys.version
'3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)]'

However, the help() function does not work which is supposed to be a builtin function in python. Attempting to call it gives this:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'help' is not defined

Is there a way to call help()?

2 Answers 2

5

The version of Python embedded in Sublime Text is not a completely full distribution, unlike for example the ones from python.org, Anaconda, etc. It doesn't include all modules and all functionality, and help() is one of the items that was dropped. The help() function is implemented in pydoc.py in a "regular" Python distribution, but I'm unsure how you would try and implement it in Sublime.

Instead of using the Ctrl` console, I find it easiest to run a Python 3 interpreter inside SublimeREPL and do my work from there.

4

For anyone ending up here from a search, importing the help function from the pydoc module seems to be working:

>>> from pydoc import help

Notably, it works with the Sublime plugin API itself, i.e.:

>>> help(sublime)
  ...
>>> help(sublime_plugin)
  ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .