Rafficer / linux-cli-community

Linux command-line client for ProtonVPN. Written in Python.
https://protonvpn.com
GNU General Public License v3.0
1.31k stars 198 forks source link

Error loading protonvpn Script #309

Open majaidi opened 3 years ago

majaidi commented 3 years ago

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

krzykro2 commented 3 years ago

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.

calexandru2018 commented 3 years ago

In which versions is this experienced ?

krzykro2 commented 3 years ago

2.2.6

kylekatarnls commented 3 years ago

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)?

krzykro2 commented 3 years ago
$ 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
MehmetCelik4 commented 3 years ago

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

ishatalov commented 3 years ago

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.

kylekatarnls commented 3 years ago

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?

eoghan-kenny commented 3 years ago

@kylekatarnls protonvpn refresh fixed issue for me - thanks!

kylekatarnls commented 3 years ago

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.