From a4d198c50e3e58200c8e8682bd2762be91b877ad Mon Sep 17 00:00:00 2001 From: gac-x04sa Date: Tue, 26 Feb 2019 15:27:05 +0100 Subject: [PATCH] Script execution --- script/device/Image.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/script/device/Image.py b/script/device/Image.py index ca4f794..aa4affc 100644 --- a/script/device/Image.py +++ b/script/device/Image.py @@ -109,7 +109,7 @@ def wait_for_file_size(filepath, size): filepath = os.path.abspath(filepath) # If the file doesn't exist, wait wait_time seconds and try again # until it's found. - while not os.path.exists(filepath) and os.path.getsize(filepath) < size: + while not os.path.exists(filepath) or size > os.path.getsize(filepath): time.sleep(wait_time) @@ -130,12 +130,11 @@ class Image(DeviceBase, Readable): def get_int(self, filename = None): if filename is None: filename = self.pixel.get_image_filename() - print "Waiting image file: " , filename, + file_size = 4 * self.pixel.PIX_XDIM * self.pixel.PIX_YDIM - print " size= ", file_size + print "Waiting image file: " , filename, " size=", file_size wait_for_file_size(filename, file_size) - - + threshold1 = self.pixel.threshold1 threshold2 = self.pixel.threshold2 threshold3 = self.pixel.threshold3