Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SandboxRepositoryBackend
: move imports out of destructor (#5316)
The import `from aiida.common.folders import SandboxFolder` was added to multiple functions and is added to the top of the module. This is not only best-practice in terms of reduction of code deduplication, in the case of its use in the `__del__` destructor, it also fixes a bug. When the destructor of the class is called, the interpreter may already have cleaned up certain things, for example parts of the `sys` module. This will make importing fail and one is greated with the exception: ImportError: sys.meta_path is None, Python is likely shutting down By moving the import to the top of the module, this is no longer the case.
- Loading branch information