Skip to content

Commit

Permalink
Use default appid if sys.argv doesn't exist. Ref jaraco#445
Browse files Browse the repository at this point in the history
Added a check that argv exists and has at least some value before accessing it.
  • Loading branch information
Alex committed Jul 15, 2020
1 parent fb74a37 commit e97704f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion keyring/backends/kwallet.py
Expand Up @@ -21,7 +21,13 @@ class DBusKeyring(KeyringBackend):
KDE KWallet 5 via D-Bus
"""

appid = os.path.basename(sys.argv[0]) or 'Python keyring library'
# See https://github.com/jaraco/keyring/issues/445
default_appid = 'Python keyring library'
appid = (
sys.argv[0] or default_appid
if hasattr(sys, 'argv') and len(sys.argv) > 0
else default_appid
)
wallet = None
bus_name = 'org.kde.kwalletd5'
object_path = '/modules/kwalletd5'
Expand Down

0 comments on commit e97704f

Please sign in to comment.