[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [policies/master] Nicer notice when dateutil is missing
commit 68d2b48ac39610297cd7f4331f69f80afca82308
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Wed Oct 4 16:54:25 2017 -0700
Nicer notice when dateutil is missing
Only dependency we have outside of builtins. Providing a nicer error when it's
unavailable.
---
scripts/email_activity.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/scripts/email_activity.py b/scripts/email_activity.py
index 70f1e4f..8359796 100644
--- a/scripts/email_activity.py
+++ b/scripts/email_activity.py
@@ -1,9 +1,14 @@
import collections
+import datetime
import re
import urllib
+import sys
-from datetime import date
-from dateutil import relativedelta # https://pypi.python.org/pypi/python-dateutil/
+try:
+ from dateutil import relativedelta
+except ImportError:
+ print("dateutil unavailable, please run 'sudo pip install python-dateutil'")
+ sys.exit(1)
EMAIL_LISTS = (
'tor-talk',
@@ -30,7 +35,7 @@ for email_list in EMAIL_LISTS:
all_list_authors = []
for month_offset in range(6):
- d = date.today() - relativedelta.relativedelta(months = month_offset)
+ d = datetime.date.today() - relativedelta.relativedelta(months = month_offset)
url = "https://lists.torproject.org/pipermail/%s/%s/author.html" % (email_list, d.strftime("%Y-%B"))
request = urllib.urlopen(url)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits