wbond / package_control

The Sublime Text package manager
https://packagecontrol.io
4.79k stars 815 forks source link

UnicodeEncodeError when installing packages (https problem) #125

Closed Sh4d0Wx closed 11 years ago

Sh4d0Wx commented 12 years ago

I've been struggling with this error for weeks and its still the same, no new posts in issues section. I started a new Issue, hopefully to bring it to the attention.

There is a problem with installing packages through package control, At first when i wanted to install packages it didnt fetch any at all, then after I've read other issues i found a solution to this by changing:

"repository_channels": [ "https://sublime.wbond.net/repositories.json" ],

to

"repository_channels": [ "http://sublime.wbond.net/repositories.json" ],

With that fix it now fetches and shows the packages, however when you pick one and install it, you get confirmation message that it has been successfully installed but it didnt install it at all and after checking the console there is this error:

Exception in thread Thread-3: Traceback (most recent call last): File ".\threading.py", line 532, in bootstrap_inner File ".\Package Control.py", line 1871, in run File ".\Package Control.py", line 1339, in install_package File ".\Package Control.py", line 1007, in download_url File ".\Package Control.py", line 602, in download File ".\urllib2.py", line 126, in urlopen File ".\urllib2.py", line 391, in open File ".\urllib2.py", line 409, in _open File ".\urllib2.py", line 369, in _call_chain File ".\Package Control.py", line 92, in https_open File ".\urllib2.py", line 1133, in do_open File ".\httplib.py", line 910, in request File ".\httplib.py", line 947, in _send_request File ".\httplib.py", line 904, in endheaders File ".\httplib.py", line 776, in _send_output File ".\httplib.py", line 735, in send File ".\Package Control.py", line 71, in connect File ".\ssl.py", line 350, in wrap_socket File ".\ssl.py", line 113, in __init UnicodeEncodeError: 'ascii' codec can't encode character u'\u0161' in position 36: ordinal not in range(128)

I get the exact same error everytime i try to install some package, I even tried portable version of sublime text but its the same. I tried latest dev version, same. Last stable version, again. Since i saw that many others have the same problem, its probably not something wrong with my setup. Please try to fix it, i would really like to be able to use package control like I did before. Thanks.

// Im on Win XP SP3

paf- commented 12 years ago

I had the same problem. I think it may caused by non-ascii characters in user's folder path (like C:\Users\something-non-ascii). As a workaround i switched to a portable version of Sublime Text 2, which i unziped to somewhere else with full ascii path. Now it works for me so far, both listing and installing packages through Package Control with no problem.

Sh4d0Wx commented 12 years ago

Thank you! That worked like a charm, didnt even have to change the repositery_channels URL and its working perfectly now, thanks again :)

wbond commented 12 years ago

There is a testing version of Package Control available which should hopefully resolve this issue thanks to @ms4py. To test it, please:

  1. In Sublime Text, click the Preferences > Browse Packages… menu entry
  2. Browse up a folder and then into the Installed Packages folder
  3. Download http://sublime.wbond.net/testing/Package%20Control.sublime-package and copy it into the Installed Packages directory
  4. Restart Sublime Text

Please post back here with your results.

vitalyrotari commented 12 years ago

Thank you wbond! All works fine.

Pentiado commented 12 years ago

I also have to say thank you wbond ;)

alienlebarge commented 11 years ago

Same UnicodeDecodeError error here. I have installed the last version of Sublime Package Control. I have set the proxy variable in Package Control.sublime-settings and I get this error :

Exception in thread Thread-1:
Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\Package Control.py", line 2484, in run
  File ".\Package Control.py", line 1699, in record_usage
  File ".\Package Control.py", line 1016, in download_url
  File ".\Package Control.py", line 630, in download
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 106: ordinal not in range(128)

Exception in thread Thread-2:
Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\Package Control.py", line 1990, in run
  File ".\Package Control.py", line 1825, in make_package_list
  File ".\Package Control.py", line 1130, in list_available_packages
  File ".\Package Control.py", line 1075, in list_repositories
  File ".\Package Control.py", line 190, in get_repositories
  File ".\Package Control.py", line 163, in fetch_channel
  File ".\Package Control.py", line 1016, in download_url
  File ".\Package Control.py", line 630, in download
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 97: ordinal not in range(128)

I'm running Windows XP

skuteli commented 11 years ago

Thank you wbond!

alienlebarge commented 11 years ago

With this testing version, is there a way to mention the domain ?

wbond commented 11 years ago

@alienlebarge can you post the contents of your Packages\User\Package Control.sublime-settings file?

alienlebarge commented 11 years ago

@wbond here it is :

{
    "http_proxy": "proxy.atwork.ch:8080",
    "https_proxy": "proxy.atwork.ch:8080",
    "proxy_username": "myusername",
    "proxy_password": "mypassword"
}
wbond commented 11 years ago

@alienlebarge Hmm, I don't see any non-ascii characters in there. I guess I'll have to dig in some more to see why you are getting those UnicodeDecodeError exceptions.

alienlebarge commented 11 years ago

@wbond My (real) password contains capital letters, lowercase letters and numbers. By cons, it has no character accentuated. It seems to be 101% ascii.

anchnk commented 11 years ago

Hello,

I have this issue too. Behind a corporate proxy network which use ntlm authentification. I've set the same settings than alien.

Here's my console output :

Exception in thread Thread-1:
Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\Package Control.py", line 2378, in run
  File ".\Package Control.py", line 1686, in record_usage
  File ".\Package Control.py", line 1007, in download_url
  File ".\Package Control.py", line 622, in download
UnicodeDecodeError: 'ascii' codec can't decode byte 0xea in position 101: ordinal not in range(128)

Exception in thread Thread-2:
Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\Package Control.py", line 1890, in run
  File ".\Package Control.py", line 1759, in make_package_list
  File ".\Package Control.py", line 1121, in list_available_packages
  File ".\Package Control.py", line 1066, in list_repositories
  File ".\Package Control.py", line 175, in get_repositories
  File ".\Package Control.py", line 148, in fetch_channel
  File ".\Package Control.py", line 1007, in download_url
  File ".\Package Control.py", line 622, in download
UnicodeDecodeError: 'ascii' codec can't decode byte 0xea in position 92: ordinal not in range(128)

Willing to help and make any test you want if you don't have access to such proxy.

anchnk commented 11 years ago

Well, i've tried both the latest version from github here and the test version you mentioned in the issue #219. None are working. Btw, the error isn't the same as the OP so we might probably open a new one. We don't get a UnicodeEncodeError but a UnicodeDecodeError.

As adrien i've set both http and https proxy address with matching username and password (which are plain ascii characters). If i don't set the https proxy, i got the error "Package control : There are no packages available for installation", console reporting :

Package Control: Error downloading channel. URL error [Errno 11001] getaddrinfo failed downloading https://sublime.wbond.net/repositories.json.
error: Package Control: There are no packages available for installation.

If i set the https proxy i do have the error reported above.

As a side note i'm using sublime text portable on this machine.

wbond commented 11 years ago

@anchnk Can you try grabbing the latest version (1.5.0.15) from http://sublime.wbond.net/testing/Package%20Control.sublime-package and posting your backtrace if you continue to have UnicodeEncodeError exceptions from ssl.py? If you have a different error, let's open a separate ticket to try and keep track of who is having what problem with what version.

alienlebarge commented 11 years ago

@wbond I've tried with the latest version (1.5.0.15) and I get this error :

Exception in thread Thread-1:
Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\Package Control.py", line 3464, in run
  File ".\Package Control.py", line 2679, in record_usage
  File ".\Package Control.py", line 1810, in download_url
  File ".\Package Control.py", line 1131, in download
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 43: ordinal not in range(128)

Exception in thread Thread-2:
Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\Package Control.py", line 2970, in run
  File ".\Package Control.py", line 2805, in make_package_list
  File ".\Package Control.py", line 1986, in list_available_packages
  File ".\Package Control.py", line 1907, in list_repositories
  File ".\Package Control.py", line 382, in get_repositories
  File ".\Package Control.py", line 349, in fetch_channel
  File ".\Package Control.py", line 1810, in download_url
  File ".\Package Control.py", line 1131, in download
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 43: ordinal not in range(128)

I've also tried using Cntlm Auth Proxy and it works. It seems it is more a problem with our corporate proxy than with your app

anchnk commented 11 years ago

Just gave it a try. Here are steps followed :

  1. Delete ST2 portable directory
  2. Unzip a fresh download of ST2 in a directory (path is U:\directory1\directory2\Sublime Text 2.0.1)
  3. Download the latest version you mentioned (1.5.0.15)
  4. Run ST2 go to preferences > browse packages, go one directory up in windows explorer then copy/paste Package Control.sublime-package in Installed Packages directory.
  5. Close ST2
  6. Restart ST2
  7. Go to preferences > package settings > package control > settings - default
  8. Set http_proxy variables as well as proxy_username and proxy_password to matching environment values.
  9. Save that file and try to install package got :
Package Control : There are no packages available for installation

And console reports :

Package Control: Error downloading channel. URL error [Errno 11001] getaddrinfo failed downloading https://sublime.wbond.net/repositories.json.
error: Package Control: There are no packages available for installation.

No try to set https_proxy variable as well, got in console the same unicode _decode _ error i posted before.

I tried a processing (based on java) snippet that i've wrote some years ago to works with my corporate proxy using ntlm scheme authentication and it works. Seems that's a problem using that authentication scheme ?

alienlebarge commented 11 years ago

Everythings was ok (using cntlm) but today, I've updated Package control using ... Package Control.

Now, I get an UnicodeDecodeError error when I try to install a new package.

Exception in thread Thread-61:
Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\Package Control.py", line 1890, in run
  File ".\Package Control.py", line 1759, in make_package_list
  File ".\Package Control.py", line 1121, in list_available_packages
  File ".\Package Control.py", line 1066, in list_repositories
  File ".\Package Control.py", line 175, in get_repositories
  File ".\Package Control.py", line 148, in fetch_channel
  File ".\Package Control.py", line 1007, in download_url
  File ".\Package Control.py", line 622, in download
UnicodeDecodeError: 'ascii' codec can't decode byte 0xfb in position 95: ordinal not in range(128)
alienlebarge commented 11 years ago

Ok, I've reinstall the testing version and now it works

wbond commented 11 years ago

The testing version (http://wbond.net/sublime_packages/package_control/installation#Testing_Version) should have this fixed now.

Deadpool13 commented 11 years ago

I'm having the same issue and installed the test version which partially fixed the problem (I can now run the Add Repository command) but still can't get the Install window up. Same ascii issue as the rest. Oddly enough it worked when I first installed but then stopped working shortly after.

schlamar commented 11 years ago

What's the error exactly (from View -> Show Console)?

Deadpool13 commented 11 years ago

I have a ú in my username, it worked when I first installed but after restarting ST2 for the second time it stopped. I've tried both the latest stable and test releases.

Exception in thread Thread-4: Traceback (most recent call last): File ".\threading.py", line 532, in bootstrap_inner File ".\Package Control.py", line 4070, in run File ".\Package Control.py", line 3886, in make_package_list File ".\Package Control.py", line 2432, in incoming File ".\Package Control.py", line 2310, in execute File ".\subprocess.py", line 633, in __init File ".\subprocess.py", line 842, in _execute_child UnicodeEncodeError: 'ascii' codec can't encode character u'\xfa' in position 11: ordinal not in range(128)