[IPython-user] Problem with %timeit and ascii codec

Prabhu Ramachandran prabhu@aero.iitb.ac...
Sun Nov 9 00:57:13 CST 2008


Hi,

I'm running IPython 0.9.1 and am running into a unicode encoding problem 
I haven't seen in earlier versions:

In [1]: import numpy

In [2]: a = numpy.linspace(0, 1, 10)

In [3]: timeit a.sum()
---------------------------------------------------------------------------
UnicodeEncodeError                        Traceback (most recent call last)

/home/prabhu/usr/virtualenv/ets_trunk/lib/python2.5/site-packages/IPython/iplib.pyc 
in ipmagic(self, arg_s)
     951         else:
     952             magic_args = self.var_expand(magic_args,1)
--> 953             return fn(magic_args)
     954
     955     def ipalias(self,arg_s):

/home/prabhu/usr/virtualenv/ets_trunk/lib/python2.5/site-packages/IPython/Magic.py 
in magic_timeit(self, parameter_s)
    1829 
precision,
    1830                                                           best 
* scaling[order],
-> 1831 
(units[order]))
    1832         if tc > tc_min:
    1833             print "Compiler time: %.2f s" % tc

UnicodeEncodeError: 'ascii' codec can't encode character u'\xb5' in 
position 30: ordinal not in range(128)

-----------------------------------------------------------------------------------

This happens when the results are in microseconds.

cheers,
prabhu


More information about the IPython-user mailing list