def _write_results(self, indicators, source_data, file_name_for_indicator_results, display_error_box): #generate a static html page for browsing outputted indicators and store the path to the html results_page_path = None results = IndicatorResults() try: results_page_path = results.create_page( source_data = source_data, page_name = file_name_for_indicator_results, indicators = indicators) except: message = 'failed to generate indicator results page' if display_error_box: display_message_dialog(message) logger.enable_hidden_error_and_warning_words() logger.log_warning(message) logger.disable_hidden_error_and_warning_words() if results_page_path is not None: results_page_path = 'file://' + results_page_path return results_page_path
exec( create_import_for_camel_case_class(classpath, import_as='ImportedConfiguration')) config = ImportedConfiguration() base_year = config['base_year'] config['creating_baseyear_cache_configuration'].cache_from_database = False config[ 'creating_baseyear_cache_configuration'].baseyear_cache.existing_cache_to_copy = cache_dir config['cache_directory'] = output_dir config['years'] = (base_year + 1, base_year + years_to_run) if not len(range(config['years'][0], config['years'][1] + 1)) > 0: display_message_dialog('No years to simulate!') sys.exit(1) # sanity check on the cache directory -- make sure it includes a subdirectory whose name is the base year base_year_directory = os.path.join(cache_dir, str(base_year)) if not os.path.exists(base_year_directory): msg = 'Invalid cache directory: %s\nThe cache directory should have a subdirectory %d for the base year' % ( cache_dir, base_year) display_message_dialog(msg) sys.exit(1) # sanity check on the output directory if output_dir_container == '': msg = 'Output directory not specified' display_message_dialog(msg) sys.exit(1)
years_to_run = args.number_of_years_to_run exec(create_import_for_camel_case_class(classpath, import_as='ImportedConfiguration')) config = ImportedConfiguration() base_year = config['base_year'] config['creating_baseyear_cache_configuration'].cache_from_database = False config['creating_baseyear_cache_configuration'].baseyear_cache.existing_cache_to_copy = cache_dir config['cache_directory'] = output_dir config['years'] = (base_year+1, base_year+years_to_run) if not len(range(config['years'][0], config['years'][1]+1)) > 0: display_message_dialog('No years to simulate!') sys.exit(1) # sanity check on the cache directory -- make sure it includes a subdirectory whose name is the base year base_year_directory = os.path.join(cache_dir, str(base_year)) if not os.path.exists(base_year_directory): msg = 'Invalid cache directory: %s\nThe cache directory should have a subdirectory %d for the base year' % (cache_dir, base_year) display_message_dialog(msg) sys.exit(1) # sanity check on the output directory if output_dir_container=='': msg = 'Output directory not specified' display_message_dialog(msg) sys.exit(1)