def dump_hex_data(self,data): fmt = '%Y%m%d_%H%M%S' ts = time.time() times = time.strftime(fmt, time.localtime(ts)) name = 'data_{}.hex'.format(self.device_type) name = os.path.join(instance.getDataPath(), name) fp = open(name, 'a+') fp.write(times +','+ data + '\n') fp.close()
def make_rawfile(self): fmt = '%Y%m%d_%H%M%S.%f' ts = time.time() name = time.strftime(fmt, time.localtime(ts)) + '.raw' name = os.path.join(instance.getDataPath(),name) self.raw_file = open(name,'w')