1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

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().
This commit is contained in:
Javi Merino 2020-03-02 13:36:48 +00:00 committed by Marc Bonnici
parent 37a6b4f96d
commit dcab0b3718

View File

@ -156,5 +156,5 @@ class DaqInstrument(Instrument):
def teardown(self): def teardown(self):
self.daq_client.close() self.daq_client.close()
if not self.keep_raw: if not self.keep_raw:
if os.path.isdir(self.tempdir): if self.tempdir and os.path.isdir(self.tempdir):
shutil.rmtree(self.tempdir) shutil.rmtree(self.tempdir)