diff --git a/python/MDSplus/tree.py b/python/MDSplus/tree.py index 79cd9892d3..a8a33fca96 100644 --- a/python/MDSplus/tree.py +++ b/python/MDSplus/tree.py @@ -574,7 +574,7 @@ def __enter__(self): return self def __del__(self): - if not self.public: + if not self.public and _TreeShr is not None: self.__exit__() _TreeShr.TreeFreeDbid(self._ctx)