noahcoad / google-spell-check

Uses Google Search spelling magic to fix words or phrases for Sublime Text.
121 stars 18 forks source link

Does not work on ST3 with Linux (Fedora 20 here) #9

Open asfaltboy opened 10 years ago

asfaltboy commented 10 years ago

Seems the extension is attempting an HTTP request using a https url, which requires Python built with SSL support. Unfortunately, the interpreter embedded in ST3 does not seem to support SSL.

Is it possible to use Google Spell Check using http requests (without SSL) ?

here is the relevant traceback from st3 console:

Traceback (most recent call last):
  File "/home/pavel/Apps/st3/sublime_plugin.py", line 549, in run_
    return self.run(edit)
  File "google-spell-check in /home/pavel/.config/sublime-text-3/Installed Packages/Google Spell Check.sublime-package", line 16, in run
  File "google-spell-check in /home/pavel/.config/sublime-text-3/Installed Packages/Google Spell Check.sublime-package", line 22, in correct
  File "google-spell-check in /home/pavel/.config/sublime-text-3/Installed Packages/Google Spell Check.sublime-package", line 47, in get_page
  File "X/urllib/request.py", line 160, in urlopen
  File "X/urllib/request.py", line 479, in open
  File "X/urllib/request.py", line 591, in http_response
  File "X/urllib/request.py", line 511, in error
  File "X/urllib/request.py", line 451, in _call_chain
  File "X/urllib/request.py", line 696, in http_error_302
  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>
rumpelsepp commented 10 years ago

The same here on Arch Linux

thomporter commented 10 years ago

Same on Ubuntu 14.04 64bit

lolalk commented 10 years ago

Same as @thomporter

jest commented 10 years ago

Same on Ubuntu 12.04 32-bit

mlk5060 commented 10 years ago

Similar issue using Ubuntu 14.04 LTS. Using Sublime Text 2 with Python 2.7.6 vanilla install and Google Spell Checker v2014.04.10.07.43.27.

Sublime Text 2 console output below:

Traceback (most recent call last): File "./sublimeplugin.py", line 362, in run File "./google-spell-check.py", line 15, in run File "./google-spell-check.py", line 22, in correct File "./google-spell-check.py", line 49, in get_page File ".\urllib2.py", line 126, in urlopen File ".\urllib2.py", line 397, in open File ".\urllib2.py", line 510, in http_response File ".\urllib2.py", line 429, in error File ".\urllib2.py", line 369, in _call_chain File ".\urllib2.py", line 605, in http_error_302 File ".\urllib2.py", line 391, in open File ".\urllib2.py", line 414, in _open File ".\urllib2.py", line 369, in _call_chain File ".\urllib2.py", line 1194, in unknown_open urllib2.URLError:

mlk5060 commented 10 years ago

Update: I've fixed the issue by altering line 22 in my "sublime-text-2/Packages/Google Spell Check/google-spell-check.py" file (this directory may be different on your file-system) to include a "gws_rd" (google web service_redirect) variable with the value "ssl" in the parameter passed to the "get_page" function (this variable is the web address used by the package to query Google). The relevant line now reads:

html = self.get_page('http://www.google.com/search?hl=en&q=' + urllib2.quote(text) + "&meta=&gws_rd=ssl")

It appears as though Google implicitly redirects your query to HTTP+SSL protocol even though the original query submitted stipulates the standard HTTP protocol. Whether this is standard Google server behaviour or something caused by my system environment is still a mystery but the fix works either way! Note that I've included a "hl" variable here with the value "en": this specifies the "interface" language or the language used to evaluate the query submitted to give context to Google's servers. If you're looking to spell-check using a language other than English, change this variable accordingly.

I've since created a pull request to the master branch of this package and hopefully the changes will be included soon but if you can't wait then its a pretty simple fix.

rhoconlinux commented 9 years ago

Hi everyone, same here. Ubuntu-Gnome 14.04.2. It doesn't work. @mlk5060 I modified the line 22 without success... nothing changes. :(

mlk5060 commented 9 years ago

I've noticed that its stopped working for me lately. Have given up using it.

noahcoad commented 9 years ago

mlk5060, thanks, i'll integrate the pull request

afcuttin commented 9 years ago

I concur (ubuntu 12.04 and ST 3)