sustained / CoffeeScript-Sublime-Plugin

Syntax highlighting and checking, commands, shortcuts, snippets, compilation and more.
MIT License
290 stars 71 forks source link

Installation fails on Sublime Text 3, build 3059 #60

Open noAlvaro opened 10 years ago

noAlvaro commented 10 years ago

Inside console, suggested command line for installation is currently throwing the following:

>>> import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
  File "<string>", line 1
    import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
                                                                                                                                                                                                                                                                                                                                                                                                            ^
SyntaxError: invalid syntax

I don't know how to fix it, can anyone help?

noAlvaro commented 10 years ago

The issue is that some packages and command syntaxes are different on Phyton 3. And well, I don't know a thing about Phyton and its versions... but I've made some tweaks to the code line that seemed to work. By using the helps of this porting guide I came up with this version:

import urllib,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib.request.install_opener(urllib.request.build_opener(urllib.request.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write( urllib.request.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print('Please restart Sublime Text to finish installation')

Still I think this is not the solution, because CoffeeScript isn't opening as an option when you try to install it in the Package Manager. :(

reydi commented 10 years ago

Having the exact same problem. Thanks @noAlvaro for fixing the line, but same here still nothing happens, Cmd+Shift+P won't show the CoffeeScript

bicepjai commented 9 years ago

i still get

open(os.path.join(ipp,pf),'wb').write( urllib.request.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); Traceback (most recent call last): File "./urllib/request.py", line 1248, in do_open File "./http/client.py", line 1065, in request File "./http/client.py", line 1103, in _send_request File "./http/client.py", line 1061, in endheaders File "./http/client.py", line 906, in _send_output File "./http/client.py", line 844, in send File "./http/client.py", line 822, in connect File "./socket.py", line 435, in create_connection File "./socket.py", line 426, in create_connection ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "./urllib/request.py", line 156, in urlopen File "./urllib/request.py", line 469, in open File "./urllib/request.py", line 487, in _open File "./urllib/request.py", line 447, in _call_chain File "./urllib/request.py", line 1268, in http_open File "./urllib/request.py", line 1251, in do_open urllib.error.URLError: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it> Traceback (most recent call last): File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 680, in update_compressed_packages multi_importer.loaders = [ZipLoader(p) for p in pkgs] File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 680, in multi_importer.loaders = [ZipLoader(p) for p in pkgs] File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 588, in init z = zipfile.ZipFile(zippath, 'r') File "./zipfile.py", line 933, in init File "./zipfile.py", line 974, in _RealGetContents zipfile.BadZipFile: File is not a zip file

bicepjai commented 9 years ago

before i use to get

by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); Traceback (most recent call last): File "./urllib/request.py", line 1248, in do_open File "./http/client.py", line 1065, in request File "./http/client.py", line 1103, in _send_request File "./http/client.py", line 1061, in endheaders File "./http/client.py", line 906, in _send_output File "./http/client.py", line 844, in send File "./http/client.py", line 822, in connect File "./socket.py", line 435, in create_connection File "./socket.py", line 426, in create_connection ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "./urllib/request.py", line 156, in urlopen File "./urllib/request.py", line 469, in open File "./urllib/request.py", line 487, in _open File "./urllib/request.py", line 447, in _call_chain File "./urllib/request.py", line 1268, in http_open File "./urllib/request.py", line 1251, in do_open urllib.error.URLError: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it>