Subsections


state.load

Image relax Image document-open

Synopsis

Load a saved program state.

Defaults

state.load(state=`state.bz2', dir=None, force=False)

Keyword arguments

state: The file name, which can be a string or a file descriptor object, of a saved program state.

dir: The name of the directory in which the file is found.

force: A boolean flag which if True will cause the current program state to be overwritten.

Description

This is able to handle uncompressed, bzip2 compressed files, or gzip compressed files automatically. The full file name including extension can be supplied, however, if the file cannot be found, this function will search for the file name with `.bz2' appended followed by the file name with `.gz' appended.

For more advanced users, file descriptor objects are supported. If the force flag is set to True, then the relax data store will be reset prior to the loading of the saved state.

Prompt examples

The following commands will load the state saved in the file `save'.

[numbers=none]
relax> state.load('save')

[numbers=none]
relax> state.load(state='save')

Use one of the following commands to load the state saved in the bzip2 compressed file `save.bz2':

[numbers=none]
relax> state.load('save')

[numbers=none]
relax> state.load(state='save')

[numbers=none]
relax> state.load('save.bz2')

[numbers=none]
relax> state.load(state='save.bz2', force=True)


The relax user manual (PDF), created 2016-10-28.