From dcab0b37181b92f6110c4c26589e3071d170afe4 Mon Sep 17 00:00:00 2001 From: Javi Merino Date: Mon, 2 Mar 2020 13:36:48 +0000 Subject: [PATCH] instrument/daq: Check that self.tempdir has been set before calling os.path.isdir() self.tempdir is initialized to None, and os.path.isdir() throws an exception if you don't pass it a str. This can happen if teardown() is called before get_data(), which WA sometimes does. Check that self.tempdir has been initializing before calling os.path.isdir(). --- devlib/instrument/daq.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devlib/instrument/daq.py b/devlib/instrument/daq.py index 459e3c4..914537f 100644 --- a/devlib/instrument/daq.py +++ b/devlib/instrument/daq.py @@ -156,5 +156,5 @@ class DaqInstrument(Instrument): def teardown(self): self.daq_client.close() if not self.keep_raw: - if os.path.isdir(self.tempdir): + if self.tempdir and os.path.isdir(self.tempdir): shutil.rmtree(self.tempdir)