diff --git a/firedrake/adjoint_utils/blocks/solving.py b/firedrake/adjoint_utils/blocks/solving.py index 694f5de7a3..9eb6a8626c 100644 --- a/firedrake/adjoint_utils/blocks/solving.py +++ b/firedrake/adjoint_utils/blocks/solving.py @@ -80,8 +80,15 @@ def _init_solver_parameters(self, args, kwargs): self.assemble_kwargs = {} def __str__(self): - return "solve({} = {})".format(ufl2unicode(self.lhs), - ufl2unicode(self.rhs)) + try: + lhs_string = ufl2unicode(self.lhs) + except AttributeError: + lhs_string = str(self.lhs) + try: + rhs_string = ufl2unicode(self.rhs) + except AttributeError: + rhs_string = str(self.rhs) + return "solve({} = {})".format(lhs_string, rhs_string) def _create_F_form(self): # Process the equation forms, replacing values with checkpoints,