summaryrefslogtreecommitdiff
path: root/ishtar_common/management
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/management')
-rw-r--r--ishtar_common/management/commands/import_geofla_csv.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/ishtar_common/management/commands/import_geofla_csv.py b/ishtar_common/management/commands/import_geofla_csv.py
index b7cb2b604..80e10bc81 100644
--- a/ishtar_common/management/commands/import_geofla_csv.py
+++ b/ishtar_common/management/commands/import_geofla_csv.py
@@ -18,6 +18,7 @@
# See the file COPYING for details.
import csv
+import sys
from django.core.management.base import BaseCommand
from django.contrib.gis.geos import GEOSGeometry, Point
@@ -36,14 +37,14 @@ class Command(BaseCommand):
def handle(self, *args, **options):
csv_file = options['csv_file']
- self.stdout.write('* Opening file {}\n'.format(csv_file))
+ sys.stdout.write('* Opening file {}\n'.format(csv_file))
default_year = options['year']
nb_created, nb_changed = 0, 0
with open(csv_file, 'rb') as csvfile:
reader = csv.DictReader(csvfile)
for idx, row in enumerate(reader):
- self.stdout.write('Processing town %d.\r' % (idx + 1))
- self.stdout.flush()
+ sys.stdout.write('Processing town %d.\r' % (idx + 1))
+ sys.stdout.flush()
num_insee = row['INSEE_COM']
if len(num_insee) < 5:
num_insee = '0' + num_insee
@@ -77,9 +78,9 @@ class Command(BaseCommand):
if not created:
nb_changed += 1
town.save()
- self.stdout.write('\n* {} town created'.format(nb_created))
- self.stdout.write('\n* {} town changed\n'.format(nb_changed))
- self.stdout.flush()
+ sys.stdout.write('\n* {} town created'.format(nb_created))
+ sys.stdout.write('\n* {} town changed\n'.format(nb_changed))
+ sys.stdout.flush()