write_model(model, model_path, backup=True, version=None)¶
Write model to files.
modelto text files in a folder(directory) tree at
Model attributes, such as its name and refs, are output in the file named _model.py, directly under model_path. For each space in the model, a text file is created with the same name as the space with “.py” extension. The tree structure of the spaces is represented by the tree of folders, i.e. child spaces of a space is stored in a folder named the space.
Generated text files are Python pseudo-scripts, i.e. they are syntactically correct but semantically not-correct Python scripts, that can only be interpreted through
Dynamic spaces and cells values are not stored.
For spaces and cells created by
new_cells_from_excel(), the source Excel files are copied into the same directory where the text files for the spaces the methods are associated with are located. Then when the model is read by
read_model()function, the methods are invoked to create the spaces or cells.
write()performs the same operation.
Changed in version 0.1.0:
versionparameter is added.
New in version 0.0.22.