commands: use print as a function
authorFrédéric Péters <fpeters@0d.be>
Mon, 6 Jan 2020 19:04:33 +0000 (20:04 +0100)
committerFrédéric Péters <fpeters@0d.be>
Mon, 6 Jan 2020 19:04:33 +0000 (20:04 +0100)
panikdb/aa/management/commands/load-csv-users.py
panikdb/stats/management/commands/load-piwik-stats.py

index eb65431..663483b 100644 (file)
@@ -40,6 +40,6 @@ class Command(BaseCommand):
                 try:
                     emissions.append(Emission.objects.get(slug=slug))
                 except Emission.DoesNotExist:
-                    print 'E: missing emission:', slug
+                    print('E: missing emission:', slug)
             user.emissions = emissions
             user.save()
index 044655d..3390856 100644 (file)
@@ -21,10 +21,10 @@ class Command(BaseCommand):
         request = urllib2.Request(url)
         request.add_header('Accept', 'application/json')
         if self.verbose:
-            print 'calling piwik'
+            print('calling piwik')
         result = json.load(urllib2.urlopen(request))
         if self.verbose:
-            print 'collecting results'
+            print('collecting results')
         for day in result:
             day_datetime = datetime.datetime.strptime(day, '%Y-%m-%d')
             for stat_segment in result.get(day):
@@ -36,7 +36,7 @@ class Command(BaseCommand):
                         soundfile = SoundFile.objects.get(id=sound_id)
                     except (SoundFile.DoesNotExist, ValueError):
                         if self.verbose:
-                            print 'failed to process', entry.get('label')
+                            print('failed to process', entry.get('label'))
                         continue
                     try:
                         stat = DailyStat.objects.get(soundfile=soundfile,