From 6333f7ba77a6b4ea2b83134f2fb77c3e26482179 Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Mon, 6 Nov 2017 13:36:58 -0500 Subject: [PATCH] AzureStorageDownloader.py: Try importing azure.storage and install if necessary --- DataScience/AzureStorageDownloader.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/DataScience/AzureStorageDownloader.py b/DataScience/AzureStorageDownloader.py index 32d9e90a..e599b968 100644 --- a/DataScience/AzureStorageDownloader.py +++ b/DataScience/AzureStorageDownloader.py @@ -1,6 +1,14 @@ -from azure.storage.blob import BlockBlobService import pickle, os, time, sys, datetime, requests, argparse import configparser +try: + from azure.storage.blob import BlockBlobService +except ImportError as e: + print('ImportError: {}'.format(e)) + if input("azure.storage.blob is required. Do you want to install it [Y/n]? ") != 'Y': + sys.exit() + import pip + pip.main(['install', 'azure.storage.blob']) + LogDownloaderURL = "https://cps-staging-exp-experimentation.azurewebsites.net/api/Log?account={ACCOUNT_NAME}&key={ACCOUNT_KEY}&start={START_DATE}&end={END_DATE}&container={CONTAINER}"