Bump to 1.1.6 to fix a user issue
[gonvert] / gonvert / gonvert_qt.py
index c37b024..074c4de 100755 (executable)
@@ -8,7 +8,11 @@ from __future__ import with_statement
 
 import os
 import math
-import simplejson
+try:
+       import json as simplejson
+except ImportError:
+       print "json not available, falling back to simplejson"
+       import simplejson
 import logging
 import logging.handlers
 
@@ -643,7 +647,13 @@ class QuickConvert(object):
                if defaultInputUnitName:
                        self.select_input(defaultInputUnitName)
                        defaultOutputUnitName = self._app.get_recent_unit(categoryName, 1)
-                       assert defaultOutputUnitName
+                       if not defaultOutputUnitName:
+                               _moduleLogger.error(
+                                       "Somehow we have an odd numer of items in the history for category %r with only %r present",
+                                       categoryName,
+                                       defaultInputUnitName,
+                               )
+                               defaultOutputUnitName = defaultInputUnitName
                        self.select_output(defaultOutputUnitName)
 
        def _select_input(self, name):