def write_patch(bname, pname, mesh="hemi"):
    p = xdrlib.Packer()
    p.pack_string(pname)
    p.pack_string(mesh)
    with tempfile.NamedTemporaryFile() as tf:
        tf.write(p.get_buffer())
        tf.flush()
        code = """with open('{tfname}', 'rb') as fp:
            u = xdrlib.Unpacker(fp.read())
            pname = u.unpack_string().decode('utf-8')
            mesh = u.unpack_string().decode('utf-8')
            blendlib.save_patch(pname, mesh)
        """.format(tfname=tf.name)
        _call_blender(bname, code)
Write out the mesh 'mesh' in the blender file 'bname' into patch file 'pname'
dataset/ETHPy150Open gallantlab/pycortex/cortex/blender/__init__.py/write_patch