From bb3f0dc1281160768dcbb67dde898b7e0a3cb57b Mon Sep 17 00:00:00 2001 From: Dan Funk Date: Thu, 5 Mar 2020 16:55:46 -0500 Subject: [PATCH] Fixing an error on Travis that wasn't showing up locally - can't close a file that never opened. --- example_data.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/example_data.py b/example_data.py index db519064..793127c3 100644 --- a/example_data.py +++ b/example_data.py @@ -78,6 +78,7 @@ class ExampleDataLoader: """Assumes that a directory exists in static/bpmn with the same name as the given id. further assumes that the [id].bpmn is the primary file for the workflow. returns an array of data models to be added to the database.""" + global file file_service = FileService() spec = WorkflowSpecModel(id=id, @@ -103,5 +104,6 @@ class ExampleDataLoader: # Ignore sub directories pass finally: - file.close() + if file: + file.close() return spec