From 65bb2c1aeb1d509c725ac768ad1b7b5153986ce8 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 30 Apr 2018 09:26:51 -0700 Subject: [PATCH] FIX: Print UID in crashfile if login name is unavailable --- nipype/pipeline/plugins/tools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nipype/pipeline/plugins/tools.py b/nipype/pipeline/plugins/tools.py index e20a01049d..79922bf998 100644 --- a/nipype/pipeline/plugins/tools.py +++ b/nipype/pipeline/plugins/tools.py @@ -38,7 +38,10 @@ def report_crash(node, traceback=None, hostname=None): if not traceback: traceback = format_exception(*sys.exc_info()) timeofcrash = strftime('%Y%m%d-%H%M%S') - login_name = getpass.getuser() + try: + login_name = getpass.getuser() + except KeyError: + login_name = 'UID{:d}'.format(os.getuid()) crashfile = 'crash-%s-%s-%s-%s' % (timeofcrash, login_name, name, str(uuid.uuid4())) crashdir = node.config['execution'].get('crashdump_dir', os.getcwd())