Поэтому, если у меня есть данные за один месяц (июль), допустимой датой является существующая папка, содержащая информацию. о рассматриваемой дате (пример: 07 июля 2016 г.). Очевидно, неправильная дата — это несуществующая папка в моей веб-службе онлайн-хранилища файлов (пример: 18 августа 2016 г.).
Вот что я должен делать в своей основной функции:
Код: Выделить всё
download_usrm(date = sys.argv[1])
Код: Выделить всё
python Extractor.py 07Jul2016
Код: Выделить всё
if key_element.startswith(date):
try:
if not os.path.exists(working_directory+ '/' +date_file+ '/'+parentKey):
os.makedirs(working_directory+ '/' +date_file+ '/'+parentKey)
key.get_contents_to_filename(working_directory+ '/' +date_file+ '/'+keyString)
for f in glob.glob(working_directory+ '/' + date_file+ '/'+ 'usrm' + '/'+ file_name+ '*.zip'):
zip_ref = zipfile.ZipFile(f, 'a')
zip_ref.extractall(working_directory + '/' + date_file+ '/'+ 'usrm' + '/' + file_id)
zip_ref.close()
os.remove(f)
except Exception as e:
print('ERROR MESSAGE : Your search did not match any documents. Try running with another date.', e)
Что может быть не так? Любая помощь приветствуется. Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/398 ... didnt-work
Мобильная версия