diff --git a/python/tvm/rpc/proxy.py b/python/tvm/rpc/proxy.py index 4c3144e7b5cd..d7027c88a4b5 100644 --- a/python/tvm/rpc/proxy.py +++ b/python/tvm/rpc/proxy.py @@ -643,7 +643,10 @@ def terminate(self): self.proc = None def __del__(self): - self.terminate() + try: + self.terminate() + except ImportError: + pass def websocket_proxy_server(url, key=""): diff --git a/python/tvm/rpc/server.py b/python/tvm/rpc/server.py index 7932e98aa20c..a144356f2e6d 100644 --- a/python/tvm/rpc/server.py +++ b/python/tvm/rpc/server.py @@ -499,4 +499,7 @@ def terminate(self): self.proc = None def __del__(self): - self.terminate() + try: + self.terminate() + except ImportError: + pass diff --git a/python/tvm/rpc/server_ios_launcher.py b/python/tvm/rpc/server_ios_launcher.py index 2e31586f6456..06ead1c3d165 100644 --- a/python/tvm/rpc/server_ios_launcher.py +++ b/python/tvm/rpc/server_ios_launcher.py @@ -335,7 +335,10 @@ def terminate(self): print(e) def __del__(self): - self.terminate() + try: + self.terminate() + except ImportError: + pass @staticmethod def is_compatible_environment():