From 226e8c549ab02dda4e667e2db60a8af11508e5f2 Mon Sep 17 00:00:00 2001 From: Paul Culley Date: Fri, 19 Feb 2021 11:23:06 -0600 Subject: [PATCH] Fix write_lock_file exception when USERNAME is missing (#1171) Fixes #12150 --- gramps/gen/db/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gramps/gen/db/utils.py b/gramps/gen/db/utils.py index 2222a3d1f..ad9c87dc1 100644 --- a/gramps/gen/db/utils.py +++ b/gramps/gen/db/utils.py @@ -42,6 +42,8 @@ from ..const import PLUGINS_DIR, USER_PLUGINS from ..constfunc import win, get_env_var from ..config import config from .dbconst import DBLOGNAME, DBLOCKFN, DBBACKEND +from ..const import GRAMPS_LOCALE as glocale +_ = glocale.translation.gettext #------------------------------------------------------------------------- # @@ -211,8 +213,8 @@ def write_lock_file(name): if win(): user = get_env_var('USERNAME') host = get_env_var('USERDOMAIN') - if host is None: - host = "" + if not user: + user = _("Unknown") else: host = os.uname()[1] # An ugly workaround for os.getlogin() issue with Konsole