diff --git a/terminatorlib/cwd.py b/terminatorlib/cwd.py index a6877b4d..7b17d84b 100755 --- a/terminatorlib/cwd.py +++ b/terminatorlib/cwd.py @@ -21,7 +21,10 @@ def get_default_cwd(): """Determine a reasonable default cwd""" cwd = os.getcwd() if not os.path.exists(cwd) or not os.path.isdir(cwd): - cwd = pwd.getpwuid(os.getuid())[5] + try: + cwd = pwd.getpwuid(os.getuid())[5] + except KeyError: + cwd = '/' return(cwd) diff --git a/terminatorlib/util.py b/terminatorlib/util.py index 872b76d0..02d7e9e6 100755 --- a/terminatorlib/util.py +++ b/terminatorlib/util.py @@ -128,7 +128,11 @@ def path_lookup(command): def shell_lookup(): """Find an appropriate shell for the user""" - shells = [os.getenv('SHELL'), pwd.getpwuid(os.getuid())[6], 'bash', + try: + usershell = pwd.getpwuid(os.getuid())[6] + except KeyError: + usershell = None + shells = [os.getenv('SHELL'), usershell, 'bash', 'zsh', 'tcsh', 'ksh', 'csh', 'sh'] for shell in shells: