diff --git a/kallithea/lib/utils2.py b/kallithea/lib/utils2.py --- a/kallithea/lib/utils2.py +++ b/kallithea/lib/utils2.py @@ -31,7 +31,6 @@ import binascii import datetime import json import os -import pwd import re import time import urllib.parse @@ -45,6 +44,12 @@ from kallithea.lib.vcs.utils import asci from kallithea.lib.vcs.utils.lazy import LazyProperty +try: + import pwd +except ImportError: + pass + + # mute pyflakes "imported but unused" assert ascii_bytes assert ascii_str @@ -331,7 +336,7 @@ def get_clone_url(clone_uri_tmpl, prefix prefix = urllib.parse.unquote(parsed_url.path.rstrip('/')) try: system_user = pwd.getpwuid(os.getuid()).pw_name - except Exception: # TODO: support all systems - especially Windows + except NameError: # TODO: support all systems - especially Windows system_user = 'kallithea' # hardcoded default value ... args = { 'scheme': parsed_url.scheme,