linux-cli-community icon indicating copy to clipboard operation
linux-cli-community copied to clipboard

Error loading protonvpn Script

Open majaidi opened this issue 3 years ago • 10 comments

Describe the bug

I got the following error randomly when it was working fine. I have tried to uninstall and reinstall a few times but with no luck.

Traceback (most recent call last): File "/bin/protonvpn", line 11, in load_entry_point('protonvpn-cli==2.2.4', 'console_scripts', 'protonvpn')() File "/usr/lib/python3.6/site-packages/protonvpn_cli/cli.py", line 73, in main cli() File "/usr/lib/python3.6/site-packages/protonvpn_cli/cli.py", line 129, in cli connection.dialog() File "/usr/lib/python3.6/site-packages/protonvpn_cli/connection.py", line 79, in dialog if not features[feat] in country_features: KeyError: 8

The way I fixed it was going onto the script is /usr/bin/protonvpn and change the version to 2.2.6. Please let me know if there is a bug that is persisting in this way after installing or upgrading.

Thanks

majaidi avatar Apr 28 '21 08:04 majaidi

I just encountered the same bug. It seems like the CLI is ready for features 0, 1, 2 and 4 (https://github.com/ProtonVPN/linux-cli-community/blob/c3f8dffad7861e57e460f2bf817cbdfbfc433420/protonvpn_cli/connection.py#L60), but the API started returning features 8, 9, 12 and potentially others. The fix for me was to change features[*] in connection.py into features.get(*), which defaults to returning None instead of throwing an exception.

krzykro2 avatar Apr 30 '21 10:04 krzykro2

In which versions is this experienced ?

calexandru2018 avatar Apr 30 '21 10:04 calexandru2018

2.2.6

krzykro2 avatar Apr 30 '21 10:04 krzykro2

Thank you, I will inspect this. Basically our API is supposed to filter any unsupported feature when it properly receive the version number with the request headers so it does not fall out of the list. I suspect the version header might be lost somewhere. You can confirm you're on the stable 2.2.6 realease (e.g. not on a fork or modified version)?

kylekatarnls avatar Apr 30 '21 11:04 kylekatarnls

$ sudo pip3 install protonvpn-cli --upgrade
Requirement already up-to-date: protonvpn-cli in /usr/local/lib/python3.6/dist-packages (2.2.6)
$ protonvpn --version
ProtonVPN-CLI v2.2.6

krzykro2 avatar Apr 30 '21 12:04 krzykro2

it is working now :)

i have same problem too. ubuntu 20.04


Traceback (most recent call last):
  File "/usr/local/bin/protonvpn", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/cli.py", line 73, in main
    cli()
  File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/cli.py", line 129, in cli
    connection.dialog()
  File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/connection.py", line 79, in dialog
    if not features[feat] in country_features:
KeyError: 8

➜ git:(master) sudo pip3 install protonvpn-cli --upgrade Requirement already up-to-date: protonvpn-cli in /usr/local/lib/python3.8/dist-packages (2.2.6) Requirement already satisfied, skipping upgrade: pythondialog in /usr/local/lib/python3.8/dist-packages (from protonvpn-cli) (3.5.1) Requirement already satisfied, skipping upgrade: requests in /usr/lib/python3/dist-packages (from protonvpn-cli) (2.22.0) Requirement already satisfied, skipping upgrade: jinja2 in /usr/local/lib/python3.8/dist-packages (from protonvpn-cli) (2.11.2) Requirement already satisfied, skipping upgrade: docopt in /usr/local/lib/python3.8/dist-packages (from protonvpn-cli) (0.6.2) Requirement already satisfied, skipping upgrade: MarkupSafe>=0.23 in /usr/lib/python3/dist-packages (from jinja2->protonvpn-cli) (1.1.0) ➜ git:(master) protonvpn --version ProtonVPN-CLI v2.2.6

MehmetCelik4 avatar May 07 '21 21:05 MehmetCelik4

I have the same issue on ubuntu 18.04:

  File "/usr/local/bin/protonvpn", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/cli.py", line 73, in main
    cli()
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/cli.py", line 129, in cli
    connection.dialog()
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/connection.py", line 79, in dialog
    if not features[feat] in country_features:
KeyError: 8

protonvpn --version ProtonVPN-CLI v2.2.6


funny, just paid for plus, should have tried it first.

ishatalov avatar May 16 '21 05:05 ishatalov

Is it possible you have an old servers list in cache? Can you try to refresh it with:

protonvpn refresh

And tell if you get rid of this error?

kylekatarnls avatar May 17 '21 10:05 kylekatarnls

@kylekatarnls protonvpn refresh fixed issue for me - thanks!

eoghan-kenny avatar May 23 '21 03:05 eoghan-kenny

Glad to hear :) I hope it was the same issue for other people in the thread. The thing is we add new servers, have to move the infra regularly so running protonvpn refresh from time to time (when using the community CLI which does not do it automatically) is needed.

And indeed install/uninstall does not clear the user cache where this list is saved.

kylekatarnls avatar May 23 '21 14:05 kylekatarnls