| 746 | print("Leave the profile browser.", file=self.stream) |
| 747 | |
| 748 | def do_read(self, line): |
| 749 | if line: |
| 750 | try: |
| 751 | with open(line, 'rb') as f: |
| 752 | raw_stats = marshal.load(f) |
| 753 | self.stats = stats_factory(raw_stats) |
| 754 | try: |
| 755 | file_stats = os.stat(line) |
| 756 | arg = time.ctime(file_stats.st_mtime) + " " + line |
| 757 | except Exception: |
| 758 | arg = line |
| 759 | self.stats.files = [arg] |
| 760 | except OSError as err: |
| 761 | print(err.args[1], file=self.stream) |
| 762 | return |
| 763 | except Exception as err: |
| 764 | print(err.__class__.__name__ + ':', err, file=self.stream) |
| 765 | return |
| 766 | self.prompt = line + "% " |
| 767 | elif len(self.prompt) > 2: |
| 768 | line = self.prompt[:-2] |
| 769 | self.do_read(line) |
| 770 | else: |
| 771 | print("No statistics object is current -- cannot reload.", file=self.stream) |
| 772 | return 0 |
| 773 | def help_read(self): |
| 774 | print("Read in profile data from a specified file.", file=self.stream) |
| 775 | print("Without argument, reload the current file.", file=self.stream) |