ueffel / Keypirinha-PackageControl

Provides commands to install/update/remove Keypirinha Packages
https://ue.spdns.de/packagecontrol/
MIT License
125 stars 1 forks source link

Error obtaining packages #4

Closed andrewgreenh closed 6 years ago

andrewgreenh commented 6 years ago

Hello there!

I have been using Keypirinha for quite some time now and I really love the concept of this package! However, whenever I try to update an existing package or install a new one, the package seems to crash. The logs display this:

2018-08-29 10:51:34.604 [i] Bookmarks.Bookmarks: Referenced 88 bookmarks
2018-08-29 10:51:52.167 [E] PackageControl.PackageControl: Available packages could not be obtained:
 Traceback (most recent call last):
  File "C:\Users\andreas\tools\Keypirinha\portable\Profile\InstalledPackages\PackageControl.keypirinha-package\packagecontrol.py", line 376, in _get_available_packages
  File "lib\json\__init__.py", line 312, in loads
TypeError: the JSON object must be str, not 'bytes'

2018-08-29 10:51:52.167 [E] Error from PackageControl.PackageControl.on_suggest: <class 'TypeError'>: 'NoneType' object is not iterable

I'm using the portable version of keypirinha, is that a problem?

ueffel commented 6 years ago

There seems to be a problem while trying to download the list of available packages. First of all check your package configuration by launching Configure Package: PackageControl in Keypirinha. Your repository setting should be "https://ue.spdns.de/packagecontrol/packages.json" (default repository). Can you confirm that you can reach https://ue.spdns.de/packagecontrol/packages.json ? Do have any proxy settings that would prevent an application like keypirinha to reach this url?

Advanced: What happens when you execute

import keypirinha_net as kpn; kpn.build_urllib_opener().open("https://ue.spdns.de/packagecontrol/packages.json").status

in the Keypirinha Console?

andrewgreenh commented 6 years ago

This is the response I'm getting from the console:

>>> import keypirinha_net as kpn; kpn.build_urllib_opener().open("https://ue.spdns.de/packagecontrol/packages.json").status
200

So that seems to be working.

And i also got that URL in the configuration file.

ueffel commented 6 years ago

Does the error reoccur if you run PackageControl: Update Repository List in Keypirinha?

andrewgreenh commented 6 years ago

This is the result in the console when starting Update Repository List

13:01:09.705 ** ERROR: PackageControl.PackageControl: Available packages could not be obtained:
 Traceback (most recent call last):
  File "C:\Users\andreas\tools\Keypirinha\portable\Profile\InstalledPackages\PackageControl.keypirinha-package\packagecontrol.py", line 376, in _get_available_packages
  File "lib\json\__init__.py", line 312, in loads
TypeError: the JSON object must be str, not 'bytes'
13:01:10.171 ** ERROR: PackageControl.PackageControl: Available packages could not be obtained:
 Traceback (most recent call last):
  File "C:\Users\andreas\tools\Keypirinha\portable\Profile\InstalledPackages\PackageControl.keypirinha-package\packagecontrol.py", line 376, in _get_available_packages
  File "lib\json\__init__.py", line 312, in loads
TypeError: the JSON object must be str, not 'bytes'
13:01:10.171 ** ERROR: PackageControl.PackageControl: Error occurred while executing command 'PackageControl: Update Repository List'
Traceback (most recent call last):
  File "C:\Users\andreas\tools\Keypirinha\portable\Profile\InstalledPackages\PackageControl.keypirinha-package\packagecontrol.py", line 220, in on_execute
  File "C:\Users\andreas\tools\Keypirinha\portable\Profile\InstalledPackages\PackageControl.keypirinha-package\packagecontrol.py", line 291, in _check_installed
  File "C:\Users\andreas\tools\Keypirinha\portable\Profile\InstalledPackages\PackageControl.keypirinha-package\packagecontrol.py", line 325, in _get_package
TypeError: 'NoneType' object is not iterable
ueffel commented 6 years ago

I dont get it... Which version Keypirinha do you have? If you execute

import keypirinha_net as kpn; kpn.build_urllib_opener().open("https://ue.spdns.de/packagecontrol/packages.json").read()

does it dump the json in the console?

andrewgreenh commented 6 years ago

:/ image

Is it possible to execute those tasks from the console directly? I'm on Keypirinha 2.9.6

andrewgreenh commented 6 years ago

Okay, I am terribly sorry... somehow I though Keypirinha would update itself automatically... I updated to the newest version and now everything is working! Thanks a lot for your help!

ueffel commented 6 years ago

Glad to hear it.

Funny... looking at the code it should not work because the json.loads() gets a bytes object rather than a string. In Python 3.6 there is some magic that autodetects the encoding decodes automatically. KP 2.9.6 probably has a Python version < 3.6 so it does not work there. (Issues https://bugs.python.org/issue10976 and https://bugs.python.org/issue27765)

Reopen: Adding backwards compatibility

polyvertex commented 6 years ago

FYI, KP 2.9.6 embeds CPython 3.5.1 IIRC.