Okay, I'm not sure what's going on here, so I'll leave this for someone else. I suspect that one of those variables is "not what you think it is", i.e. not a UFL object. Perhaps you accidentally overwrote a variable, or just set it to the wrong object?
The original error message turns out to be misleading. Apparently the as_ufl call in ufl/constantvalue.py is failing, which is the real error. In trying to generate an error message for that, it tries to generate a string representation of the expression, which also failed, producing the error that you reported.
Full traceback:
(firedrake) andrew@ubuntu:~/anna/buoy2d/Inequality-constraint-Rockafellar$ python buoy-swe.py
UFL:ERROR UFL conditions cannot be evaluated as bool in a Python context.
Traceback (most recent call last):
File "buoy-swe.py", line 82, in <module>
F_solver = solver_F(phi0_5, h1, lambda0_5, Z1, W0_5, I, w, phi0, h0, Z0, W0, phi_t, h_t, lambda_t, Z_t, W_t, I_t, v1, v2, v3, v4, v5, v6, dt, Hx, H0, L, dR_dt, g, rho, Mass, H, a, r, coords.dat.data, solvers_print);
File "/home/andrew/anna/buoy2d/Inequality-constraint-Rockafellar/solvers.py", line 25, in solver_F
+ 0.5*((lambda0_5 + exp(r*(h0-(Z0 - H - tan(a)*(x-L)))) - 1) + abs(lambda0_5 + exp(r*(h0-(Z0 - H - tan(a)*(x-L)))) - 1))*exp(r*(h0-(Z0 - H - tan(a)*(x-L)))) )*dx
File "/home/andrew/firedrake/src/ufl/ufl/operators.py", line 584, in exp
return _mathfunction(f, Exp)
File "/home/andrew/firedrake/src/ufl/ufl/operators.py", line 570, in _mathfunction
f = as_ufl(f)
File "/home/andrew/firedrake/src/ufl/ufl/constantvalue.py", line 417, in as_ufl
" to any UFL type." % str(expression))
File "/home/andrew/firedrake/local/lib/python2.7/site-packages/numpy/core/numeric.py", line 1961, in array_str
return array2string(a, max_line_width, precision, suppress_small, ' ', "", str)
File "/home/andrew/firedrake/local/lib/python2.7/site-packages/numpy/core/arrayprint.py", line 463, in array2string
separator, prefix, formatter=formatter)
File "/home/andrew/firedrake/local/lib/python2.7/site-packages/numpy/core/arrayprint.py", line 327, in _array2string
suppress_small, formatter)
File "/home/andrew/firedrake/local/lib/python2.7/site-packages/numpy/core/arrayprint.py", line 290, in _get_format_function
formatdict = _get_formatdict(data, precision, suppress_small, formatter)
File "/home/andrew/firedrake/local/lib/python2.7/site-packages/numpy/core/arrayprint.py", line 239, in _get_formatdict
'int': IntegerFormat(data),
File "/home/andrew/firedrake/local/lib/python2.7/site-packages/numpy/core/arrayprint.py", line 654, in __init__
max_str_len = max(len(str(maximum.reduce(data))),
File "/home/andrew/firedrake/src/ufl/ufl/conditional.py", line 46, in __bool__
error("UFL conditions cannot be evaluated as bool in a Python context.")
File "/home/andrew/firedrake/src/ufl/ufl/log.py", line 172, in error
raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: UFL conditions cannot be evaluated as bool in a Python context.