OverFlowError in Point.py

Bug #1234528 reported by Ortbauer Martin Leopold
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyqtgraph
Fix Committed
Undecided
Unassigned

Bug Description

This error made my plot unuseable:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pyqtgraph/graphicsItems/PlotCurveItem.py", line 157, in boundingRect
    py = 0 if py is None else py.length()
  File "/usr/lib/python2.7/site-packages/pyqtgraph/Point.py", line 102, in length
    return (self[0]**2 + self[1]**2) ** 0.5
OverflowError: (34, 'Numerical result out of range')

I don't really know what this part of the code is doing, but a simple try, except clause and returning 0 fixed it for me, my patch:

--- Pointold.py 2013-10-03 08:27:43.516809404 +0000
+++ /usr/lib/python2.7/site-packages/pyqtgraph/Point.py 2013-10-03 08:19:50.750115343 +0000
@@ -99,7 +99,10 @@

     def length(self):
         """Returns the vector length of this Point."""
- return (self[0]**2 + self[1]**2) ** 0.5
+ try:
+ return (self[0]**2 + self[1]**2) ** 0.5
+ except:
+ return 0

     def norm(self):
         """Returns a vector in the same direction with unit length."""

Revision history for this message
lcampagn (luke-campagnola) wrote :

Thank you! This will be fixed in the next release.

Changed in pyqtgraph:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.