comparison cmd2.py @ 200:05c0e28306d3

expanding ~ in file names
author catherine@Elli.myhome.westell.com
date Fri, 27 Feb 2009 21:08:10 -0500
parents 12c2d23caf19
children 6cdf53ce84f5
comparison
equal deleted inserted replaced
199:12c2d23caf19 200:05c0e28306d3
742 print 'Error saving %s: %s' % (fname, str(e)) 742 print 'Error saving %s: %s' % (fname, str(e))
743 743
744 def do_load(self, fname=None): 744 def do_load(self, fname=None):
745 """Runs command(s) from a file.""" 745 """Runs command(s) from a file."""
746 if fname is None: 746 if fname is None:
747 fname = self.defaultFileName 747 fname = self.defaultFileName
748 fname = os.path.expanduser(fname)
748 keepstate = Statekeeper(self, ('stdin','use_rawinput','prompt','continuationPrompt')) 749 keepstate = Statekeeper(self, ('stdin','use_rawinput','prompt','continuationPrompt'))
749 if isinstance(fname, file): 750 if isinstance(fname, file):
750 self.stdin = fname 751 self.stdin = fname
751 else: 752 else:
752 try: 753 try: