Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Full Sublime Text 3 compatibility. #69

merged 3 commits into from Aug 3, 2013


None yet

cluther commented Feb 6, 2013

I've been trying to port some of my favorite Sublime Text 2 plugins to Sublime Text 3.

I believe I've tested all functionality and have everything working in ST2. However, it isn't backwards compatible with ST2.

I'll let you decide how you want to handle compatibility. I see that you were making some initial attempt at importing from future to attempt to keep it compatible. I plan on keeping this in a python3 branch for now, and certainly wouldn't mind if you did the same.

Thanks for the plugin!

👍 please pull

Amen! Would love this

JustSid commented Mar 4, 2013


This is what I get in the error log

File "/Users/.../Sublime Text 3/Packages/Gist/gist.py", line 337, in api_request_native
request.add_header('Authorization', 'token ' + token_auth_string())
TypeError: Can't convert 'bytes' object to str implicitly
error: Gist: unknown error (please, report a bug!)


cluther commented Mar 6, 2013

@jcontonio This is one of the many fixes already in the pull request.

Ah cool thanks @cluther

any chance it would get merged? at least to different branch?

I get this error whenever trying to do anything with the plugin. My .../User/Gist.sublime-settings file has a token and username and password in it.

Gist: GitHub username or password isn't provided in  Gist.sublime-settings file

Current Build is: 3021


cluther commented Mar 25, 2013

I just amended the pull request with a fix to the problem @ninnypants reported. I don't know how this was working for me previously. I had to move all of the initialization code out of the module scope to comply with the new Sublime Text 3 API, specifically the "Restricted API Usage at Startup" section of the following document.


thank you @cluther, for now I've cloned your python3 repo and it's working.

ptim commented Apr 3, 2013

thanks @cluther i can create private gists with your fork, though I can't open gists.. good enough!


cluther commented Apr 3, 2013

@ptim: If you open the Sublime Text console and attempt to open a gist, do you see any errors? This works for me, but it's pretty slow and I only have ~50 gists.

ptim commented Apr 4, 2013

@cluther i see:

Traceback (most recent call last): File "~/Library/Application Support/Sublime Text 3/Packages/Gist/gist.py", line 197, in _fn return fn(*args, **kwargs) File "~/Library/Application Support/Sublime Text 3/Packages/Gist/gist.py", line 669, in run self.get_window().show_quick_panel(gist_names, on_gist_num) File "/Applications/Sublime Text.app/Contents/MacOS/sublime.py", line 301, in show_quick_panel items_per_row, on_select, on_highlight, flags, selected_index) TypeError: String required error: Gist: unknown error (please, report a bug!)
(I've substituted ~)


cluther commented Apr 4, 2013

@ptim Do you use any non-default parameters in your Gist.sublime-settings? Such as include_orgs, include_users, show_authors or other? Can you show your Gist.sublime-settings with credentials removed?

I can't reproduce this, and am having a hard time guessing what could be going on just from that traceback and the code.

Do you have any gists? Considering that you're able to create private gists, I'm assuming you do. But it can't hurt to ask.

ptim commented Apr 4, 2013

thanks for the help @cluther - i think that include_orgs was the culprit - i set it to false and I can now create, open, update - awesome! thanks!

For reference, my user settings:

    // Your username on GitHub
    "username": "ptim",

    // Your password on GitHub
    "password": "###",

    // Your GitHub API token
    // see: https://github.com/condemil/Gist#generating-access-token
    "token": "###",

    // Show GitHub organizations
    "include_orgs": false,
    // "include_orgs": ["company1", "company2"],

@ptim you probably want to remove your access credentials from those settings...

ptim commented Apr 4, 2013

how embarrassing!!! tx for the heads up @nathankot ... I had replaced them with ### as above, but looks like there was a markdown preview/save glitch :(

PW changed, API regenerated.

@cluther So I forgot to come back and let you know that cleared up the problem for me. Though I do have a problem when listing gists. Sublime Text will spin and actually go unresponsive for a second then pop up the error.

error: Gist: unknown error (please, report a bug!)

@cluther If I use your python3 branch I get the following error (the same as a commentor earlier, though you told him this is fixed in the pull request):

[...]Packages/Gist/gist.py", line 337, in api_request_native
    request.add_header('Authorization', 'token ' + token_auth_string())
TypeError: Can't convert 'bytes' object to str implicitly

cluther commented May 24, 2013

@Tyderion: The file and line number in that error don't correspond to what's in my python3 branch. Are you sure you have the latest of the python3 branch of the cluther/Gist repository?

@cluther HA! thanks for the tip, I forgot to checkout the python3 branch xD now that is a stupid mistake :)
Thanks for answering this fast! 👍

Any chance this will be merged soon?

take a look at sublime-github instead. Works great in sublime text 3.


cluther commented Jun 24, 2013

Thanks @mhenrixon. That looks like the way to go.

pgolm commented Jul 5, 2013

The python version for Linux isn't compiled with SSL 😢, so i get this error:

Traceback (most recent call last):
  File "/home/pgolm/.config/sublime-text-3/Packages/Gist/gist.py", line 197, in _fn
    return fn(*args, **kwargs)
  File "/home/pgolm/.config/sublime-text-3/Packages/Gist/gist.py", line 620, in run
    filtered = gists_filter(get_gists())
  File "/home/pgolm/.config/sublime-text-3/Packages/Gist/gist.py", line 305, in get_gists
    return api_request(GISTS_URL)
  File "/home/pgolm/.config/sublime-text-3/Packages/Gist/gist.py", line 382, in api_request_native
    with contextlib.closing(urllib.urlopen(request)) as response:
  File "X/urllib/request.py", line 160, in urlopen
  File "X/urllib/request.py", line 473, in open
  File "X/urllib/request.py", line 496, in _open
  File "X/urllib/request.py", line 451, in _call_chain
  File "X/urllib/request.py", line 1314, in unknown_open
urllib.error.URLError: <urlopen error unknown url type: https>
error: Gist: Error while contacting GitHub

@condemil condemil merged commit c4e8cf9 into condemil:master Aug 3, 2013

@cluther where you found the documentation regarding

view.run_command('append', {
    'characters': gist['files'][gist_filename]['content'],


view.run_command('insert', {
    'characters': gist['files'][gist_filename]['content'],

cluther replied Sep 8, 2013

@condemil: I found it in the Sublime Text 3 porting guide. In the Restricted begin_edit() and end_edit() section.


@cluther thank you, but I know about this article and read it several times. I mean where I can get a list of commands, like append or delete and parameters of this commands, like characters.


cluther replied Sep 9, 2013

@condemil: Ah, that is very hard information to find. I learn about these mostly by opening the console and running sublime.log_commands(True) then performing the action I want my plugin to do. This is quite useful. Other than that I find a plugin that does something similar to what I want to do and look at its source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment