def write_to_dev(device, s_path): if not os.path.exists(s_path): raise Exception('source path %s does not found!' % s_path) block_dev = BlockDevice(device) block_dev.check_id_mbr() try: data = open(s_path, 'rb').read() except IOError: raise IOError('Can not read from "%s"' % s_path) block_dev.int_write(data)
def write_to_dev(device, s_path): if not os.path.exists(s_path): raise Exception('source path %s does not found!'%s_path) block_dev = BlockDevice(device) block_dev.check_id_mbr() try: data = open(s_path, 'rb').read() except IOError: raise IOError('Can not read from "%s"'%s_path) block_dev.int_write(data)