Mercurial > python-cmd2
comparison cmd2.py @ 224:0a7e97f79a60
tweaked error message
author | catherine@Elli.myhome.westell.com |
---|---|
date | Thu, 19 Mar 2009 06:00:08 -0400 |
parents | 1702ce785a8d |
children | 061db156c99f |
comparison
equal
deleted
inserted
replaced
223:1702ce785a8d | 224:0a7e97f79a60 |
---|---|
873 except Exception, e: | 873 except Exception, e: |
874 print 'Error saving %s: %s' % (fname, str(e)) | 874 print 'Error saving %s: %s' % (fname, str(e)) |
875 | 875 |
876 urlre = re.compile('(https?://[-\\w\\./]+)') | 876 urlre = re.compile('(https?://[-\\w\\./]+)') |
877 def do_load(self, fname=None): | 877 def do_load(self, fname=None): |
878 """Runs command(s) from a file.""" | 878 """Runs script of command(s) from a file or URL.""" |
879 if fname is None: | 879 if fname is None: |
880 fname = self.default_file_name | 880 fname = self.default_file_name |
881 #keepstate = Statekeeper(self, ('stdin','use_rawinput','prompt','continuation_prompt')) | 881 #keepstate = Statekeeper(self, ('stdin','use_rawinput','prompt','continuation_prompt')) |
882 keepstate = Statekeeper(self, ('stdin','use_rawinput','continuation_prompt')) | 882 keepstate = Statekeeper(self, ('stdin','use_rawinput','continuation_prompt')) |
883 try: | 883 try: |
893 target = open(os.path.expanduser(fname), 'r') | 893 target = open(os.path.expanduser(fname), 'r') |
894 except IOError, e: | 894 except IOError, e: |
895 target = open('%s.%s' % (os.path.expanduser(fname), | 895 target = open('%s.%s' % (os.path.expanduser(fname), |
896 self.defaultExtension), 'r') | 896 self.defaultExtension), 'r') |
897 except IOError, e: | 897 except IOError, e: |
898 print 'Problem opening file %s: \n%s' % (fname, e) | 898 print 'Problem accessing script from %s: \n%s' % (fname, e) |
899 keepstate.restore() | 899 keepstate.restore() |
900 return | 900 return |
901 self.stdin = target | 901 self.stdin = target |
902 self.use_rawinput = False | 902 self.use_rawinput = False |
903 self.prompt = self.continuation_prompt = '' | 903 self.prompt = self.continuation_prompt = '' |