From 1ddde33490aedb697b1de9ec4712982bfdc05229 Mon Sep 17 00:00:00 2001
From: benSepanski <ben_sepanski@alumni.baylor.edu>
Date: Thu, 9 Jul 2020 10:59:04 -0500
Subject: [PATCH] Add guard on firedrake_connection example in case firedrake
 cannot be imported

---
 examples/firedrake_connection.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/examples/firedrake_connection.py b/examples/firedrake_connection.py
index a7bffdb1..2621de4e 100644
--- a/examples/firedrake_connection.py
+++ b/examples/firedrake_connection.py
@@ -29,6 +29,12 @@ import pyopencl as cl
 #     written by Andreas Klockner:
 #    https://gitlab.tiker.net/inducer/meshmode/-/blob/7826fa5e13854bf1dae425b4226865acc10ee01f/examples/simple-dg.py  # noqa : E501
 def main():
+    # If can't import firedrake, do nothing
+    try:
+        import firedrake
+    except ImportError:
+        return 0
+
     # For this example, imagine we wish to solve the Laplace equation
     # on a meshmode mesh with some given Dirichlet boundary conditions,
     # and decide to use firedrake.
-- 
GitLab