From 9ac7f3366410ff89958ead2205984d2a25026cb4 2009-04-03 08:55:39 From: Fernando Perez Date: 2009-04-03 08:55:39 Subject: [PATCH] Fix https://bugs.launchpad.net/ipython/+bug/348466 The fix is not ideal, but at least it makes %timeit work. I'd like to have a better solution though in the long term. --- diff --git a/IPython/Magic.py b/IPython/Magic.py index f500698..1546f63 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -1800,7 +1800,24 @@ Currently the magic system has the following functions:\n""" import timeit import math - units = [u"s", u"ms", u"\xb5s", u"ns"] + # XXX: Unfortunately the unicode 'micro' symbol can cause problems in + # certain terminals. Until we figure out a robust way of + # auto-detecting if the terminal can deal with it, use plain 'us' for + # microseconds. Note: using + # + # s = u'\xb5' + # s.encode(sys.getdefaultencoding()) + # + # is not sufficient, as I've seen terminals where that fails but + # print s + # + # succeeds + # + # See bug: https://bugs.launchpad.net/ipython/+bug/348466 + + #units = [u"s", u"ms",u'\xb5',"ns"] + units = [u"s", u"ms",u'us',"ns"] + scaling = [1, 1e3, 1e6, 1e9] opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',