From 195fb15f5ef4cf9de705b0ef9ad611ba175bf65d Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 12 Dec 2014 15:21:58 +0000 Subject: [PATCH] test for missing "future" package see https://github.com/jcupitt/libvips/issues/208 not sure why this fails silently without the extra try block --- python/Vips.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/python/Vips.py b/python/Vips.py index 6e5a873b..6d1dbe39 100644 --- a/python/Vips.py +++ b/python/Vips.py @@ -2,7 +2,18 @@ # vim: tabstop=4 shiftwidth=4 expandtab from __future__ import division -from builtins import map + +# if this is py2 and future is not found, it's the first import from builtins +# that fails silently, for some reason + +# raise a RuntimeError, this is not caught by our importer + +try: + from builtins import map +except Exception as e: + raise RuntimeError("Unable to import 'map' from 'builtins': " + str(e) + + " -- maybe try 'pip install future'") + from builtins import str from builtins import range from builtins import object