Skip to content

Commit

Permalink
Ensure graceful error in GeosLibrary.__del__ with missing instance at…
Browse files Browse the repository at this point in the history
…tributes
  • Loading branch information
molinav committed Feb 24, 2025
1 parent 1b6ee1c commit 52eb850
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/basemap/utils/GeosLibrary.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021-2024 Víctor Molina García
# Copyright (c) 2021-2025 Víctor Molina García
#
# GeosLibrary.py is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
Expand Down Expand Up @@ -62,7 +62,7 @@ def __init__(self, version, root=None):
def __del__(self):
"""Clean up after :class:`GeosLibrary` destruction."""

if self.temp:
if getattr(self, "temp", None) and getattr(self, "root", None):
try:
shutil.rmtree(self.root)
except OSError:
Expand Down

0 comments on commit 52eb850

Please sign in to comment.