Subject: [Thuban-list] Thuban CVS version: cannot classify on incomplete data - unsupported operand type(s) for -: 'NoneType' and 'NoneType'

From: "Moritz Lennert" <[email-masked]>
Date: Tue, 23 Mar 2004 15:43:24 +0100 (CET)

Hello,

I am using the current CVS version.

I have a shapefile (and dbf file) with 589 entities and a data table with
data for 129 of these entities. I can join the two tables using an
external join. The result seems coherent with most lines in grey (no data)
and the 129 lines with data.

However, when I choose one of the incomplete fields and hit the "Generate
classes" button, I get the following error

Une exception non gérée a été déclenchée:
unsupported operand type(s) for -: 'NoneType' and 'NoneType'
(veuillez faire un rapport à l'adresse
http://thuban.intevation.org/bugtracker.html)

Traceback (most recent call last):
  File "/usr/lib/thuban/Thuban/UI/classifier.py", line 1075, in _OnGenClass
    self.fields.GetString(self.__cur_field))
  File "/usr/lib/thuban/Thuban/UI/classgen.py", line 125, in __init__
    obj = clazz(self, self.layer, self.fieldName, self.fieldType)
  File "/usr/lib/thuban/Thuban/UI/classgen.py", line 1008, in __init__
    self.datashow = PointDensityGram(self, data=curdata)
  File "/usr/lib/thuban/Thuban/UI/graph.py", line 50, in __init__
    self.data = [ (d-mnd)/(mxd-mnd) for d in data ]
TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'

As this is one of the first attempts of one of my colleagues to use Thuban
in production, I would really like to find the answer to this problem.

Moritz

---

From: Bernhard Herzog <[email-masked]>
Date: Tue, 23 Mar 2004 16:27:38 +0100

> TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'

The Table objects return None for NULL values in the database.  It
appears that the code in graph.py doesn't handle that case.  In this
particular case it's Daniel's code apparently, but I think some of out
code doesn't handle None correctly either.

I've create RT #2361 for this.

   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Skencil                                http://sketch.sourceforge.net/
Thuban                                  http://thuban.intevation.org/