diff --git a/python-samples/batchimport/batch_import_locations.py b/python-samples/batchimport/batch_import_locations.py index e1d55bb..c12559b 100755 --- a/python-samples/batchimport/batch_import_locations.py +++ b/python-samples/batchimport/batch_import_locations.py @@ -101,11 +101,10 @@ def import_batch(batch, use_put=False): try: woosmap_location = datagov2woosmap(location, "ID" + str(id)) + batch.append(woosmap_location) if len(batch) == batch_size: batch_result = import_batch(batch, use_put=update_location) batch = [] - else: - batch.append(woosmap_location) except InvalidGeometry: pass diff --git a/python-samples/woosmap_to_woosmap/woosmap_to_woosmap.py b/python-samples/woosmap_to_woosmap/woosmap_to_woosmap.py index 9d7999f..5c5e8ed 100644 --- a/python-samples/woosmap_to_woosmap/woosmap_to_woosmap.py +++ b/python-samples/woosmap_to_woosmap/woosmap_to_woosmap.py @@ -32,8 +32,8 @@ def transform_geojson_woosmap(extracted_geojson): "name": prop.get("name", ""), "tags": prop.get("tags", []), "contact": prop.get("contact", {})}) - except BaseException as error: - print('An exception occurred: {}'.format(error)) + except Exception as err: + print('An exception occurred: {}'.format(err)) return stores @@ -90,15 +90,14 @@ def import_location(locations): export_input_json(stores_woosmap) if private_key: for store in stores_woosmap: + batch.append(store) if len(batch) == stores_batch_size: batch_result = import_location(batch) batch = [] - else: - batch.append(store) if batch: batch_result = import_location(batch) batch = [] - except BaseException as error: # bad bad way! - print('An exception occurred: {}'.format(error)) + except Exception as err: + print('An exception occurred: {}'.format(err))