def export(project_path, dst_path): p = Project(project_path, False) p.load() if p.has_error(): raise Exception('All errors must be fixed before exporting.') from structer.exporter import DefaultObjectExporter exp = DefaultObjectExporter(p) from zipfile import ZipFile zf = None try: zf = ZipFile(dst_path, 'w') files = exp.export() for fn, data in files: zf.writestr(fn, data) finally: if zf: zf.close()
def _load_project(self, path): from structer.project import Project project = Project(path, False) project.load() self.update_project(project)