-def save():
- """Function to save persistent variables to a file."""
-
- # try to open the variable file
- try:
- file_descriptor = file(variable_file, "w")
-
- # failing that, make the directory in which it resides first
- except IOError:
- os.makedirs(os.sep.join(variable_file.split(os.sep)[:-1]))
- file_descriptor = file(variable_file, "w")
-
- # now write the data and close out the file
- variable_data.write(file_descriptor)
- file_descriptor.flush()
- file_descriptor.close()
-