Show More
@@ -1672,6 +1672,12 class InteractiveShell(SingletonConfigurable): | |||
|
1672 | 1672 | |
|
1673 | 1673 | return etype, value, tb |
|
1674 | 1674 | |
|
1675 | def show_usage_error(self, exc): | |
|
1676 | """Show a short message for UsageErrors | |
|
1677 | ||
|
1678 | These are special exceptions that shouldn't show a traceback. | |
|
1679 | """ | |
|
1680 | self.write_err("UsageError: %s" % exc) | |
|
1675 | 1681 | |
|
1676 | 1682 | def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None, |
|
1677 | 1683 | exception_only=False): |
@@ -1698,7 +1704,7 class InteractiveShell(SingletonConfigurable): | |||
|
1698 | 1704 | # line, there may be SyntaxError cases with imported code. |
|
1699 | 1705 | self.showsyntaxerror(filename) |
|
1700 | 1706 | elif etype is UsageError: |
|
1701 |
self. |
|
|
1707 | self.show_usage_error(value) | |
|
1702 | 1708 | else: |
|
1703 | 1709 | if exception_only: |
|
1704 | 1710 | stb = ['An exception has occurred, use %tb to see ' |
@@ -2597,8 +2603,8 class InteractiveShell(SingletonConfigurable): | |||
|
2597 | 2603 | try: |
|
2598 | 2604 | self.input_transformer_manager.push(raw_cell) |
|
2599 | 2605 | cell = self.input_transformer_manager.source_reset() |
|
2600 | except UsageError: | |
|
2601 |
self.show |
|
|
2606 | except UsageError as e: | |
|
2607 | self.show_usage_error(e) | |
|
2602 | 2608 | return |
|
2603 | 2609 | |
|
2604 | 2610 | # Our own compiler remembers the __future__ environment. If we want to |
General Comments 0
You need to be logged in to leave comments.
Login now