def to_disk(self, path=None, name=None):
"""read from ram, overwrite disk"""
if not self._inram:
raise Exception('Not in ram. Cant write to disk.')
if path is None:
path = self.path
if name is None:
name = self.name
if not os.path.isdir(path):
os.makedirs(path)
with cd(path):
with open(name, 'wb') as fil_out:
fil_out.write(self.data)
if self.executable:
os.chmod(self.name, stat.S_IEXEC)
self._ondisk = True
评论列表
文章目录