Israel Brewster wrote:
The problem is that, from time to time, I can't get a connection, the result
being that cursor is None,

That's your problem right there -- you want a better-behaved
version of psql_cursor().

def get_psql_cursor():
   c = psql_cursor()
   if c is None:
      raise CantGetAConnectionError()
   return c

with get_psql_cursor() as c:
   ...

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to