Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't launch protonvpn-app from script #82

Open
1 task
LittleBangTheory opened this issue Nov 11, 2024 · 0 comments
Open
1 task

Can't launch protonvpn-app from script #82

LittleBangTheory opened this issue Nov 11, 2024 · 0 comments

Comments

@LittleBangTheory
Copy link

We are happy to answer your questions about the code or discuss technical ideas.

Please complete the following checklist (by adding [x]):

  • [X ] I have searched open and closed issues for duplicates
  • [ X] This isn't a feature request
  • This is not a report about my app not working as expected

Environment

Issue

Hello,

For context, i have been trying to execute the protonvpn-app from a script linked to a .desktop file, to automatize the deactivation of my custom DNS when I launch the ProtonVPN, and activation when I close it.

Using the protonvpn-app command from a normal terminal works fine, but when trying in the terminal opened by Ubuntu from the .desktop file, I get this error trace :

Traceback (most recent call last):
  File "/usr/bin/protonvpn-app", line 33, in <module>
    sys.exit(load_entry_point('proton-vpn-gtk-app==4.6.0', 'console_scripts', 'protonvpn-app')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/protonvpn-app", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/proton/vpn/app/gtk/__init__.py", line 36, in <module>
    logging.config(filename="vpn-app")
  File "/usr/lib/python3/dist-packages/proton/vpn/logging/__init__.py", line 126, in config
    default_logdirpath = os.path.join(VPNExecutionEnvironment().path_cache, "logs")
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/proton/utils/metaclasses.py", line 25, in __call__
    cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/proton/utils/environment.py", line 116, in __init__
    super().__init__()
  File "/usr/lib/python3/dist-packages/proton/utils/environment.py", line 38, in __init__
    self._setup_as_regular_user()
  File "/usr/lib/python3/dist-packages/proton/utils/environment.py", line 78, in _setup_as_regular_user
    config_home, cache_home, runtime_dir = self._get_dir_paths()
                                           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/proton/utils/environment.py", line 91, in _get_dir_paths
    runtime_dir = BaseDirectory.get_runtime_dir()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/xdg/BaseDirectory.py", line 141, in get_runtime_dir
    return os.environ['XDG_RUNTIME_DIR']
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 685, in __getitem__
KeyError: 'XDG_RUNTIME_DIR'

What surprises me is that the XDG_RUNTIME_DIR is well set in the windows where I get the error, and has the same value as in any other windows, being /run/user/1000.

Also, when using env to print all the environnement variables, and trying a diff between the two outputs, the only differences where not meaningful ones, meaning LESSCLOSE, LESSOPEN, LS_COLORS, and the GNOME_TERMINAL_SCREEN that is obviously different.

Additional informations

If of any use, here is the .desktop file :

[Desktop Entry]
Type=Application
Name=VPN  
Categories=Application;Maintenance
Exec=$REDACTED_PATH/vpn.sh
Icon=/usr/share/icons/protonvpn.svg
Terminal=true

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant