Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run_import(self, import_dir):
try:
importer = SingleOutputEcospold2Importer(
import_dir,
self.db_name,
extractor=ActivityBrowserExtractor,
signal=import_signals.strategy_progress
)
importer.apply_strategies()
importer.write_database(backend='activitybrowser')
if not import_signals.cancel_sentinel:
import_signals.finished.emit()
else:
self.delete_canceled_db()
except ImportCanceledError:
self.delete_canceled_db()
except InvalidExchange:
# Likely caused by new version of ecoinvent not finding required
# biosphere flows.