Prints a rich render of the last exception and traceback. Args: width (Optional[int], optional): Number of characters used to render code. Defaults to 100. extra_lines (int, optional): Additional lines of code to render. Defaults to 3. theme (str, optiona
(
self,
*,
width: Optional[int] = 100,
extra_lines: int = 3,
theme: Optional[str] = None,
word_wrap: bool = False,
show_locals: bool = False,
suppress: Iterable[Union[str, ModuleType]] = (),
max_frames: int = 100,
)
| 1871 | self._check_buffer() |
| 1872 | |
| 1873 | def print_exception( |
| 1874 | self, |
| 1875 | *, |
| 1876 | width: Optional[int] = 100, |
| 1877 | extra_lines: int = 3, |
| 1878 | theme: Optional[str] = None, |
| 1879 | word_wrap: bool = False, |
| 1880 | show_locals: bool = False, |
| 1881 | suppress: Iterable[Union[str, ModuleType]] = (), |
| 1882 | max_frames: int = 100, |
| 1883 | ) -> None: |
| 1884 | """Prints a rich render of the last exception and traceback. |
| 1885 | |
| 1886 | Args: |
| 1887 | width (Optional[int], optional): Number of characters used to render code. Defaults to 100. |
| 1888 | extra_lines (int, optional): Additional lines of code to render. Defaults to 3. |
| 1889 | theme (str, optional): Override pygments theme used in traceback |
| 1890 | word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False. |
| 1891 | show_locals (bool, optional): Enable display of local variables. Defaults to False. |
| 1892 | suppress (Iterable[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback. |
| 1893 | max_frames (int): Maximum number of frames to show in a traceback, 0 for no maximum. Defaults to 100. |
| 1894 | """ |
| 1895 | from .traceback import Traceback |
| 1896 | |
| 1897 | traceback = Traceback( |
| 1898 | width=width, |
| 1899 | extra_lines=extra_lines, |
| 1900 | theme=theme, |
| 1901 | word_wrap=word_wrap, |
| 1902 | show_locals=show_locals, |
| 1903 | suppress=suppress, |
| 1904 | max_frames=max_frames, |
| 1905 | ) |
| 1906 | self.print(traceback) |
| 1907 | |
| 1908 | @staticmethod |
| 1909 | def _caller_frame_info( |