Changeset 151:a2584357ff6c for src/mlx/pirep.py
- Timestamp:
- 05/05/12 11:02:52 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/pirep.py
r102 r151 4 4 5 5 import const 6 import cPickle as pickle 6 7 7 8 #------------------------------------------------------------------------------ … … 25 26 some other things.""" 26 27 return "[" + timeStr + "]-[" + line + "]" 28 29 @staticmethod 30 def load(path): 31 """Load a PIREP from the given path. 32 33 Returns the PIREP object, or None on error.""" 34 try: 35 with open(path, "rb") as f: 36 return pickle.load(f) 37 except Exception, e: 38 print "Failed loading PIREP from %s: %s" % (path, str(e)) 39 return None 27 40 28 41 def __init__(self, gui): … … 114 127 star += self.transition 115 128 return star.upper() 129 130 def save(self, path): 131 """Save the PIREP to the given file. 132 133 Returns whether the saving has succeeded.""" 134 try: 135 with open(path, "wb") as f: 136 pickle.dump(self, f) 137 return True 138 except Exception, e: 139 print "Failed saving PIREP to %s: %s" % (path, str(e)) 140 return False
Note:
See TracChangeset
for help on using the changeset viewer.