web/hdalab/management/commands/import_insee_csv.py
changeset 124 f937ccc6c144
parent 123 94fc5f5b5cfd
child 231 73123394bc53
--- a/web/hdalab/management/commands/import_insee_csv.py	Thu Feb 23 19:45:00 2012 +0100
+++ b/web/hdalab/management/commands/import_insee_csv.py	Fri Feb 24 18:38:00 2012 +0100
@@ -47,13 +47,13 @@
                     #print rawdata
                     try:
                         latitude = float(rawdata['latitude'].replace(',','.'))
-                        longitude = float(rawdata['latitude'].replace(',','.'))
+                        longitude = float(rawdata['longitude'].replace(',','.')) if rawdata['longitude'] != '-' else 0
                         insee = int(rawdata['insee'])
                         ville = unicode(rawdata['ville'], 'iso-8859-1')
                         
                         InseeCoords.objects.get_or_create(insee=insee, city_name=ville, latitude=latitude, longitude=longitude)
                         
                     except:
-                        print "Error :", sys.exc_info()[1]
+                        print line, "Error :", sys.exc_info()[1]
         
         csvfile.close()
\ No newline at end of file