Skip to content

Commit ad8c318

Browse files
committed
Catch error if user is unknown
1 parent bf65c2e commit ad8c318

File tree

1 file changed

+6
-1
lines changed
  • polyaxon_client/tracking/utils

1 file changed

+6
-1
lines changed

polyaxon_client/tracking/utils/env.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,19 @@ def get_packages():
4949
version = pkg_resources.get_distribution(PROJECT_CLIENT_NAME).version
5050
except pkg_resources.DistributionNotFound:
5151
version = ''
52+
try:
53+
user = getpass.getuser()
54+
except Exception as e:
55+
logger.debug('Could not detect installed packages, %s', e)
56+
user = 'unknown'
5257
return {
5358
'pid': os.getpid(),
5459
'hostname': socket.gethostname(),
5560
'os': platform.platform(aliased=True),
5661
'system': platform.system(),
5762
'python_version_verbose': sys.version,
5863
'python_version': platform.python_version(),
59-
'user': getpass.getuser(),
64+
'user': user,
6065
'client_version': version,
6166
'sys.argv': sys.argv,
6267
'is_notebook': is_notebook(),

0 commit comments

Comments
 (0)