13. Saving and restoring variables and sessions

Saving and restoring variables automatically. To enable automatic saving and restoring of variables across HIPE session, choose EditPreferences, go to Startup & Shutdown and tick the Save variables on exit checkbox. If you tick the Ask which variables to restore at startup checkbox, HIPE will offer you at each startup a choice of variables to restore.

Not all variable types can be saved and restored. Among those that can be saved and restored are the following:

[Warning] Warning

Saving and restoring large variables can slow down HIPE considerably.

Saving and restoring variables from the command line. You can save and restore variables at any moment during a HIPE session, by using the save and restore commands as shown by the following example:

# Define three variables
a = 1
b = [1,2,3]
c = "Hello world"

# Save two of the above variables
save("ab.ser", "a,b")

# Save all variables

# Make all variables invalid
a = b = c = None
print a,b,c

# Restore a,b,c
print a, b, c
[Note] Note

Use the extension .ser when saving variables to file. If you use another extension, HIPE shows a warning message.

Saving and restoring full HIPE sessions. Use the FileSession menu to export the current HIPE session to file, or to import a saved session. You can export one or more variables, preferences (the ones you set via EditPreferences) and configuration properties (stored in .props files such as hipe.props). For more information on preferences and properties see Section 4.

[Warning] Warning

The file format of variables exported with FileSessionExport has changed from HIPE 10. This means that HIPE 10 or higher will not be able to read session variables exported with HIPE 9, and vice-versa.

If you exported variables with HIPE 9 or a previous version, follow this workaround to read them in HIPE 10 or higher:

  1. Open HIPE 9 and import the exported variables with FileSessionImport.

  2. Set Save variables on exit in the Preferences dialogue window, under GeneralStartup & Shutdown.

  3. Exit HIPE 9.

  4. Open HIPE 10. The variables shall be restored in the Variables view.

  5. Export the variables with the new format of HIPE 10, with FileSessionExport.