diff --git a/gramps/gen/db/write.py b/gramps/gen/db/write.py index 742898352..5e51c3421 100644 --- a/gramps/gen/db/write.py +++ b/gramps/gen/db/write.py @@ -2529,7 +2529,9 @@ def write_lock_file(name): try: user = os.getlogin() except: - user = os.environ['USER'] #not win, don't need get_env_var + # not win, so don't need get_env_var. + # under cron getlogin() throws and there is no USER. + user = os.environ.get('USER', 'noUSER') if host: text = "%s@%s" % (user, host) else: