Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full Sublime Text 3 compatibility. #69

Merged
merged 3 commits into from Aug 3, 2013
Merged

Conversation

cluther
Copy link
Contributor

@cluther 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!

@plukevdh
Copy link

👍 please pull

@mhenrixon
Copy link

Amen! Would love this

@JustSid
Copy link

JustSid commented Mar 4, 2013

+1

@jcontonio
Copy link

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
Copy link
Contributor Author

cluther commented Mar 6, 2013

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

@jcontonio
Copy link

Ah cool thanks @cluther

@huglester
Copy link

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

@ninnypants
Copy link

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
Copy link
Contributor Author

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.

http://www.sublimetext.com/docs/3/porting_guide.html

@huglester
Copy link

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

@ptim
Copy link

ptim commented Apr 3, 2013

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

@cluther
Copy link
Contributor Author

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
Copy link

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
Copy link
Contributor Author

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
Copy link

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"],
}

@nathankot
Copy link

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

@ptim
Copy link

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.

@ninnypants
Copy link

@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!)

@Tyderion
Copy link

@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
Copy link
Contributor Author

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?

@Tyderion
Copy link

@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! 👍

@jonschlinkert
Copy link

Any chance this will be merged soon?

@mhenrixon
Copy link

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

@cluther
Copy link
Contributor Author

cluther commented Jun 24, 2013

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

@pgolm
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet