1234567891011121314151617 |
- def dump(self, save=False):
- try:
- if __name__ == '__main__':
- f = open("/tmp/test", "wb")
- else:
- f = open(settings.SAVE_FILE, "wb")
- except Exception:
- # TODO : Custom exeption for saving error
- raise Exception("Error while saving : data may be unavailable")
- if self.save_file == None:
- self.save_file = self.init_save()
- pickle.dump(self.save_file, f)
- f.close()
- f = open('/tmp/bidule', 'w')
- f.write(json.dumps(self.save_file))
- f.close()
|