From bc0195ba733eafaa8b124db379bee3935bc9ca2c Mon Sep 17 00:00:00 2001
From: Gabriel Ganne <gabriel.ganne@qosmos.com>
Date: Thu, 14 Jul 2016 10:18:57 +0200
Subject: [PATCH] Fix scapy init without gtk

matplotlib.pyplot inits gtk, which may not be available.
If so, handles this as if the import failed.
---
 scapy/arch/__init__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scapy/arch/__init__.py b/scapy/arch/__init__.py
index 2dc13750..058f0f17 100644
--- a/scapy/arch/__init__.py
+++ b/scapy/arch/__init__.py
@@ -21,7 +21,8 @@ try:
     else:
         MATPLOTLIB_INLINED = 0
     MATPLOTLIB_DEFAULT_PLOT_KARGS = {"marker": "+"}
-except ImportError:
+# RuntimeError to catch gtk "Cannot open display" error
+except (ImportError, RuntimeError) as e:
     plt = None
     MATPLOTLIB = 0
     MATPLOTLIB_INLINED = 0
-- 
GitLab