From 6d4c1437a76c9a9b808aeaf1d252ff5c787aa9a0 Mon Sep 17 00:00:00 2001 From: Guille Date: Thu, 2 May 2024 15:39:01 +0200 Subject: [PATCH] meb workflow small corrections --- hub_api/workflow/insel_montly_energy_balance.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hub_api/workflow/insel_montly_energy_balance.py b/hub_api/workflow/insel_montly_energy_balance.py index cdf0c9a..7bb24f0 100644 --- a/hub_api/workflow/insel_montly_energy_balance.py +++ b/hub_api/workflow/insel_montly_energy_balance.py @@ -43,7 +43,7 @@ class InselMonthlyEnergyBalance(Resource, Config): year_of_construction_field=year_of_construction_field, function_field=function_field, function_to_hub=function_dictionary).city - except TypeError: + except KeyError: return None def _citygml(self, file_path): @@ -58,7 +58,7 @@ class InselMonthlyEnergyBalance(Resource, Config): function_field=function_field, function_to_hub=function_dictionary, hub_crs=hub_crs).city - except TypeError: + except KeyError: return None def post(self): @@ -77,8 +77,8 @@ class InselMonthlyEnergyBalance(Resource, Config): tmp_path = (self._tmp_path / token).resolve() try: os.mkdir(tmp_path) - except: - print('already exist') + except FileExistsError: + pass geometry_file = request.files['geometry_file'] if not self._allowed_extensions(geometry_file.filename): shutil.rmtree(tmp_path) @@ -120,4 +120,4 @@ class InselMonthlyEnergyBalance(Resource, Config): 'yearly_appliances_peak_load': building.appliances_peak_load[cte.YEAR] } shutil.rmtree(tmp_path) - return Response(json.dumps({'result': 'succeed', 'results': json.dumps(results)}), status=200, headers=response_token) + return Response(json.dumps({'result': 'succeed', 'results': results}), status=200, headers=response_token)