From 8bed109e41d84d7fe5d26b6baeb0da89f5a37904 Mon Sep 17 00:00:00 2001
From: Vanessasaurus <814322+vsoch@users.noreply.github.com>
Date: Tue, 18 May 2021 23:33:09 -0600
Subject: monitor: fix issue with attribute lookup (#23773)

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
---
 lib/spack/spack/monitor.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'lib')

diff --git a/lib/spack/spack/monitor.py b/lib/spack/spack/monitor.py
index b4e8475e70..4c89b49b71 100644
--- a/lib/spack/spack/monitor.py
+++ b/lib/spack/spack/monitor.py
@@ -228,7 +228,7 @@ class SpackMonitorClient:
         except URLError as e:
 
             # If we have an authorization request, retry once with auth
-            if e.code == 401 and retry:
+            if hasattr(e, "code") and e.code == 401 and retry:
                 if self.authenticate_request(e):
                     request = self.prepare_request(
                         e.url,
-- 
cgit v1.2.3-70-g09d2