[IPython-User] running sum(datetime.timedelta) gives an error! but not always

MinRK benjaminrk@gmail....
Thu Jun 27 13:06:39 CDT 2013

If you start IPython with `--pylab`, then `sum` is actually `numpy.sum`,
rather than the builtin.

On Mon, Jun 24, 2013 at 1:09 PM, BrunoV <bruno.vitorge@pasteur.fr> wrote:

> Hello, I'm new to this list and a beginner in python.
>  I'm trying to use datetime module.
> to do it simple here is the part of the  code I'm using:
> import datetime as dtm
> toto = [[dtm.timedelta(0, 25200), dtm.timedelta(0, 3600)]]
> print sum(toto)
> If I start ipython with this line:
> ipython -pylab -wthread and then  copy paste these lines in Ipython console
> using %cpaste
> everything it is working as expected.
> But if I run the file containing this portion of code using the %run
> the_file.py, I get the following error:
> TypeError: unsupported operand type(s) for +: 'int' and 'list'
> WARNING: Failure executing file: <try.py>
> I get the same error in Ipython console when Ipython is started without any
> option.
> So I suppose the error is linked with the use of  pylab option.
> Is it normal that using %run, and  using %cpaste I'm getting the same
> behaviour?
> How can I get my script working using %run
> Thank you very much for your answers.
> Regards
> --
> View this message in context:
> http://python.6.x6.nabble.com/running-sum-datetime-timedelta-gives-an-error-but-not-always-tp5022260.html
> Sent from the IPython - User mailing list archive at Nabble.com.
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130627/0c6f1fcc/attachment.html 

More information about the IPython-User mailing list