From ddce662fe64a693f64f9fda4b5e406be8f1278d1 Mon Sep 17 00:00:00 2001 From: Justus Wingert Date: Sat, 15 Nov 2014 22:39:15 +0100 Subject: Added try/except block for import errors with harparser and pytz. --- examples/har_extractor.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/har_extractor.py b/examples/har_extractor.py index c994f371..531f32aa 100644 --- a/examples/har_extractor.py +++ b/examples/har_extractor.py @@ -2,8 +2,14 @@ This inline script utilizes harparser.HAR from https://github.com/JustusW/harparser to generate a HAR log object. """ -from pytz import utc -from harparser import HAR +try: + from harparser import HAR + from pytz import UTC +except ImportError as e: + import sys + print >> sys.stderr, "\r\nMissing dependencies: please run `pip install mitmproxy[examples]`.\r\n" + raise + from datetime import datetime, timedelta, tzinfo -- cgit v1.2.3