*************************************************************************** IPython post-mortem report {'commit_hash': '2486838d9', 'commit_source': 'installation', 'default_encoding': 'UTF-8', 'ipython_path': '/srv/public/kliem/sage/local/lib/python3.7/site-packages/IPython', 'ipython_version': '7.16.1', 'os_name': 'posix', 'platform': 'Linux-4.19.0-10-amd64-x86_64-with-debian-10.8', 'sys_executable': '/srv/public/kliem/sage/local/bin/python3', 'sys_platform': 'linux', 'sys_version': '3.7.3 (default, Jul 25 2020, 13:03:44) \n[GCC 8.3.0]'} *************************************************************************** *************************************************************************** Crash traceback: --------------------------------------------------------------------------- --------------------------------------------------------------------------- TypeError Python 3.7.3: /srv/public/kliem/sage/local/bin/python3 Wed Mar 10 09:58:38 2021 A problem occurred executing Python code. Here is the sequence of function calls leading up to the error, with the most recent (innermost) call last. /srv/public/kliem/sage/local/lib/python3.7/site-packages/IPython/terminal/ptutils.py in get_completions(self=, document=Document('P = pol', 7), complete_event=CompleteEvent(text_inserted=False, completion_requested=True)) 112 try: --> 113 yield from self._get_completions(body, offset, cursor_position, self.ipy_completer) self._get_completions = body = 'P = pol' offset = 7 cursor_position = 7 self.ipy_completer = 114 except Exception as e: /srv/public/kliem/sage/local/lib/python3.7/site-packages/IPython/terminal/ptutils.py in _get_completions(body='P = pol', offset=7, cursor_position=7, ipyc=) 125 body, ipyc.completions(body, offset)) --> 126 for c in completions: c = undefined completions = 127 if not c.text: /srv/public/kliem/sage/local/lib/python3.7/site-packages/IPython/core/completer.py in _deduplicate_completions(text='P = pol', completions=) 437 """ --> 438 completions = list(completions) completions = global list = undefined 439 if not completions: /srv/public/kliem/sage/local/lib/python3.7/site-packages/IPython/core/completer.py in completions(self=, text='P = pol', offset=7) 1817 try: -> 1818 for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000): c = undefined self._completions = > text = 'P = pol' offset = 7 global _timeout = undefined self.jedi_compute_type_timeout = 400 1819 if c and (c in seen): /srv/public/kliem/sage/local/lib/python3.7/site-packages/IPython/core/completer.py in _completions(self=, full_text='P = pol', offset=7, _timeout=0.4) 1861 matched_text, matches, matches_origin, jedi_matches = self._complete( -> 1862 full_text=full_text, cursor_line=cursor_line, cursor_pos=cursor_column) full_text = 'P = pol' cursor_line = 0 global cursor_pos = undefined cursor_column = 7 1863 /srv/public/kliem/sage/local/lib/python3.7/site-packages/IPython/core/completer.py in _complete(self=, cursor_line=0, cursor_pos=7, line_buffer='P = pol', text='pol', full_text='P = pol') 2029 completions = self._jedi_matches( -> 2030 cursor_pos, cursor_line, full_text) cursor_pos = 7 cursor_line = 0 full_text = 'P = pol' 2031 /srv/public/kliem/sage/local/lib/python3.7/site-packages/IPython/core/completer.py in _jedi_matches(self=, cursor_column=7, cursor_line=0, text='P = pol') 1373 interpreter = jedi.Interpreter( -> 1374 text[:offset], namespaces, column=cursor_column, line=cursor_line + 1) text = 'P = pol' offset = 7 namespaces = undefined global column = undefined cursor_column = 7 global line = undefined cursor_line = 0 1375 try_jedi = True /srv/public/kliem/sage/local/lib/python3.7/site-packages/jedi/api/__init__.py in __init__(self= instance, code='P = pol', namespaces=[{'AA': Algebraic Real Field, 'AbelianGroup': , 'AbelianGroupMorphism': , 'AbelianGroupWithValues': , 'AbelianVariety': , 'AdditiveAbelianGroup': , 'AdditiveAbelianGroupWrapper': , 'AdditiveAbelianGroupWrapperElement': , 'AdditiveMagmas': , 'AffineCryptosystem': , ...}, {'AA': Algebraic Real Field, 'AbelianGroup': , 'AbelianGroupMorphism': , 'AbelianGroupWithValues': , 'AbelianVariety': , 'AdditiveAbelianGroup': , 'AdditiveAbelianGroupWrapper': , 'AdditiveAbelianGroupWrapperElement': , 'AdditiveMagmas': , 'AffineCryptosystem': , ...}], **kwds={'column': 7, 'line': 1}) 725 super().__init__(code, environment=environment, --> 726 project=Project(Path.cwd()), **kwds) global project = global Project = global Path.cwd = > kwds = {'column': 7, 'line': 1} 727 self.namespaces = namespaces TypeError: __init__() got an unexpected keyword argument 'column' During handling of the above exception, another exception occurred: --------------------------------------------------------------------------- AttributeError Python 3.7.3: /srv/public/kliem/sage/local/bin/python3 Wed Mar 10 09:58:38 2021 A problem occurred executing Python code. Here is the sequence of function calls leading up to the error, with the most recent (innermost) call last. /srv/public/kliem/sage/src/bin/sage-ipython in 1 #!/usr/bin/env sage-python 2 # -*- coding: utf-8 -*- 3 """ 4 Sage IPython startup script. 5 """ 6 7 # Display startup banner. Do this before anything else to give the user 8 # early feedback that Sage is starting. 9 from sage.misc.banner import banner 10 banner() 11 12 from sage.repl.interpreter import SageTerminalApp 13 14 app = SageTerminalApp.instance() 15 app.initialize() ---> 16 app.start() global app.start = > /srv/public/kliem/sage/local/lib/python3.7/site-packages/IPython/terminal/ipapp.py in start(self=) 341 if self.log_level <= logging.INFO: print() 342 343 def _pylab_changed(self, name, old, new): 344 """Replace --pylab='inline' with --pylab='auto'""" 345 if new == 'inline': 346 warnings.warn("'inline' not available as pylab backend, " 347 "using 'auto' instead.") 348 self.pylab = 'auto' 349 350 def start(self): 351 if self.subapp is not None: 352 return self.subapp.start() 353 # perform any prexec steps: 354 if self.interact: 355 self.log.debug("Starting IPython's mainloop...") --> 356 self.shell.mainloop() self.shell.mainloop = > 357 else: 358 self.log.debug("IPython not interactive...") 359 if not self.shell.last_execution_succeeded: 360 sys.exit(1) 361 362 def load_default_config(ipython_dir=None): 363 """Load the default config file from the default ipython_dir. 364 365 This is useful for embedded shells. 366 """ 367 if ipython_dir is None: 368 ipython_dir = get_ipython_dir() 369 370 profile_dir = os.path.join(ipython_dir, 'profile_default') 371 app = TerminalIPythonApp() /srv/public/kliem/sage/local/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py in mainloop(self=, display_banner=) 548 if (not self.confirm_exit) \ 549 or self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'): 550 self.ask_exit() 551 552 else: 553 if code: 554 self.run_cell(code, store_history=True) 555 556 def mainloop(self, display_banner=DISPLAY_BANNER_DEPRECATED): 557 # An extra layer of protection in case someone mashing Ctrl-C breaks 558 # out of our internal code. 559 if display_banner is not DISPLAY_BANNER_DEPRECATED: 560 warn('mainloop `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2) 561 while True: 562 try: --> 563 self.interact() self.interact = > 564 break 565 except KeyboardInterrupt as e: 566 print("\n%s escaped interact()\n" % type(e).__name__) 567 finally: 568 # An interrupt during the eventloop will mess up the 569 # internal state of the prompt_toolkit library. 570 # Stopping the eventloop fixes this, see 571 # https://github.com/ipython/ipython/pull/9867 572 if hasattr(self, '_eventloop'): 573 self._eventloop.stop() 574 575 self.restore_term_title() 576 577 578 _inputhook = None /srv/public/kliem/sage/local/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py in interact(self=, display_banner=) 531 def ask_exit(self): 532 self.keep_running = False 533 534 rl_next_input = None 535 536 def interact(self, display_banner=DISPLAY_BANNER_DEPRECATED): 537 538 if display_banner is not DISPLAY_BANNER_DEPRECATED: 539 warn('interact `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2) 540 541 self.keep_running = True 542 while self.keep_running: 543 print(self.separate_in, end='') 544 545 try: --> 546 code = self.prompt_for_code() code = undefined self.prompt_for_code = > 547 except EOFError: 548 if (not self.confirm_exit) \ 549 or self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'): 550 self.ask_exit() 551 552 else: 553 if code: 554 self.run_cell(code, store_history=True) 555 556 def mainloop(self, display_banner=DISPLAY_BANNER_DEPRECATED): 557 # An extra layer of protection in case someone mashing Ctrl-C breaks 558 # out of our internal code. 559 if display_banner is not DISPLAY_BANNER_DEPRECATED: 560 warn('mainloop `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2) 561 while True: /srv/public/kliem/sage/local/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py in prompt_for_code(self=) 459 # prompt in a different event loop. 460 # If we don't do this, people could spawn coroutine with a 461 # while/true inside which will freeze the prompt. 462 463 try: 464 old_loop = asyncio.get_event_loop() 465 except RuntimeError: 466 # This happens when the user used `asyncio.run()`. 467 old_loop = None 468 469 asyncio.set_event_loop(self.pt_loop) 470 try: 471 with patch_stdout(raw=True): 472 text = self.pt_app.prompt( 473 default=default, --> 474 **self._extra_prompt_options()) self._extra_prompt_options = > 475 finally: 476 # Restore the original event loop. 477 asyncio.set_event_loop(old_loop) 478 479 return text 480 481 def enable_win_unicode_console(self): 482 # Since IPython 7.10 doesn't support python < 3.6 and PEP 528, Python uses the unicode APIs for the Windows 483 # console by default, so WUC shouldn't be needed. 484 from warnings import warn 485 warn("`enable_win_unicode_console` is deprecated since IPython 7.10, does not do anything and will be removed in the future", 486 DeprecationWarning, 487 stacklevel=2) 488 489 def init_io(self): /srv/public/kliem/sage/local/lib/python3.7/site-packages/prompt_toolkit/shortcuts/prompt.py in prompt(self=, message=, editing_mode=None, refresh_interval=None, vi_mode=None, lexer=, completer=None, complete_in_thread=False, is_password=None, key_bindings=None, bottom_toolbar=None, style=None, color_depth=None, include_default_pygments_style=None, style_transformation=None, swap_light_and_dark_colors=None, rprompt=None, multiline=True, prompt_continuation=.>, wrap_lines=None, enable_history_search=None, search_ignore_case=None, complete_while_typing=None, validate_while_typing=None, complete_style=, auto_suggest=None, validator=None, clipboard=None, mouse_support=None, input_processors=[ConditionalProcessor(processor=. at 0x7f85a235fb70>))], reserve_space_for_menu=6, enable_system_prompt=None, enable_suspend=None, enable_open_in_editor=None, tempfile_suffix=None, tempfile=None, default='', accept_default=False, pre_run=None, set_exception_handler=True) 979 self.tempfile_suffix = tempfile_suffix 980 if tempfile is not None: 981 self.tempfile = tempfile 982 983 self._add_pre_run_callables(pre_run, accept_default) 984 self.default_buffer.reset( 985 default if isinstance(default, Document) else Document(default) 986 ) 987 self.app.refresh_interval = self.refresh_interval # This is not reactive. 988 989 # If we are using the default output, and have a dumb terminal. Use the 990 # dumb prompt. 991 if self._output is None and is_dumb_terminal(): 992 return get_event_loop().run_until_complete(self._dumb_prompt(self.message)) 993 --> 994 return self.app.run(set_exception_handler=set_exception_handler) self.app.run = > set_exception_handler = True 995 996 async def _dumb_prompt(self, message: AnyFormattedText = "") -> _T: 997 """ 998 Prompt function for dumb terminals. 999 1000 Dumb terminals have minimum rendering capabilities. We can only print 1001 text to the screen. We can't use colors, and we can't do cursor 1002 movements. The Emacs inferior shell is an example of a dumb terminal. 1003 1004 We will show the prompt, and wait for the input. We still handle arrow 1005 keys, and all custom key bindings, but we don't really render the 1006 cursor movements. Instead we only print the typed character that's 1007 right before the cursor. 1008 """ 1009 # Send prompt to output. /srv/public/kliem/sage/local/lib/python3.7/site-packages/prompt_toolkit/application/application.py in run(self=, pre_run=None, set_exception_handler=True) 797 # We don't create a new event loop by default, because we want to be 798 # sure that when this is called multiple times, each call of `run()` 799 # goes through the same event loop. This way, users can schedule 800 # background-tasks that keep running across multiple prompts. 801 try: 802 loop = get_event_loop() 803 except RuntimeError: 804 # Possibly we are not running in the main thread, where no event 805 # loop is set by default. Or somebody called `asyncio.run()` 806 # before, which closes the existing event loop. We can create a new 807 # loop. 808 loop = new_event_loop() 809 set_event_loop(loop) 810 811 return loop.run_until_complete( --> 812 self.run_async(pre_run=pre_run, set_exception_handler=set_exception_handler) self.run_async = > pre_run = None set_exception_handler = True 813 ) 814 815 def _handle_exception( 816 self, loop: AbstractEventLoop, context: Dict[str, Any] 817 ) -> None: 818 """ 819 Handler for event loop exceptions. 820 This will print the exception, using run_in_terminal. 821 """ 822 # For Python 2: we have to get traceback at this point, because 823 # we're still in the 'except:' block of the event loop where the 824 # traceback is still available. Moving this code in the 825 # 'print_exception' coroutine will loose the exception. 826 tb = get_traceback_from_context(context) 827 formatted_tb = "".join(format_tb(tb)) /usr/lib/python3.7/asyncio/base_events.py in run_until_complete(self=<_UnixSelectorEventLoop running=False closed=False debug=False>, future=) 569 future.add_done_callback(_run_until_complete_cb) 570 try: 571 self.run_forever() 572 except: 573 if new_task and future.done() and not future.cancelled(): 574 # The coroutine raised a BaseException. Consume the exception 575 # to not log a warning, the caller doesn't have access to the 576 # local task. 577 future.exception() 578 raise 579 finally: 580 future.remove_done_callback(_run_until_complete_cb) 581 if not future.done(): 582 raise RuntimeError('Event loop stopped before Future completed.') 583 --> 584 return future.result() future.result = 585 586 def stop(self): 587 """Stop running the event loop. 588 589 Every callback already scheduled will still run. This simply informs 590 run_forever to stop looping after a complete iteration. 591 """ 592 self._stopping = True 593 594 def close(self): 595 """Close the event loop. 596 597 This clears the queues and shuts down the executor, 598 but does not wait for the executor to finish. 599 /srv/public/kliem/sage/local/lib/python3.7/site-packages/prompt_toolkit/application/application.py in run_async(self=, pre_run=None, set_exception_handler=True) 763 # go in the finally! If `_run_async` raises 764 # `KeyboardInterrupt`, we still want to wait for the 765 # background tasks. 766 await self.cancel_and_wait_for_background_tasks() 767 768 # Set the `_is_running` flag to `False`. Normally this 769 # happened already in the finally block in `run_async` 770 # above, but in case of exceptions, that's not always the 771 # case. 772 self._is_running = False 773 return result 774 finally: 775 if set_exception_handler: 776 loop.set_exception_handler(previous_exc_handler) 777 --> 778 return await _run_async2() _run_async2 = ._run_async2 at 0x7f85a235fc80> 779 780 def run( 781 self, 782 pre_run: Optional[Callable[[], None]] = None, 783 set_exception_handler: bool = True, 784 ) -> _AppResult: 785 """ 786 A blocking 'run' call that waits until the UI is finished. 787 788 This will start the current asyncio event loop. If no loop is set for 789 the current thread, then it will create a new loop. 790 791 :param pre_run: Optional callable, which is called right after the 792 "reset" of the application. 793 :param set_exception_handler: When set, in case of an exception, go out /srv/public/kliem/sage/local/lib/python3.7/site-packages/prompt_toolkit/application/application.py in _run_async2() 751 752 loop = get_event_loop() 753 if set_exception_handler: 754 previous_exc_handler = loop.get_exception_handler() 755 loop.set_exception_handler(self._handle_exception) 756 757 try: 758 with set_app(self): 759 try: 760 result = await _run_async() 761 finally: 762 # Wait for the background tasks to be done. This needs to 763 # go in the finally! If `_run_async` raises 764 # `KeyboardInterrupt`, we still want to wait for the 765 # background tasks. --> 766 await self.cancel_and_wait_for_background_tasks() global self.cancel_and_wait_for_background_tasks = undefined 767 768 # Set the `_is_running` flag to `False`. Normally this 769 # happened already in the finally block in `run_async` 770 # above, but in case of exceptions, that's not always the 771 # case. 772 self._is_running = False 773 return result 774 finally: 775 if set_exception_handler: 776 loop.set_exception_handler(previous_exc_handler) 777 778 return await _run_async2() 779 780 def run( 781 self, /srv/public/kliem/sage/local/lib/python3.7/site-packages/prompt_toolkit/application/application.py in cancel_and_wait_for_background_tasks(self=) 852 853 async def cancel_and_wait_for_background_tasks(self) -> None: 854 """ 855 Cancel all background tasks, and wait for the cancellation to be done. 856 If any of the background tasks raised an exception, this will also 857 propagate the exception. 858 859 (If we had nurseries like Trio, this would be the `__aexit__` of a 860 nursery.) 861 """ 862 for task in self.background_tasks: 863 task.cancel() 864 865 for task in self.background_tasks: 866 try: --> 867 await task task = .async_completer() done, defined at /srv/public/kliem/sage/local/lib/python3.7/site-packages/prompt_toolkit/buffer.py:1841> exception=AttributeError("'TypeError' object has no attribute 'tb_frame'")> 868 except CancelledError: 869 pass 870 871 def cpr_not_supported_callback(self) -> None: 872 """ 873 Called when we don't receive the cursor position response in time. 874 """ 875 if not self.input.responds_to_cpr: 876 return # We know about this already. 877 878 def in_terminal() -> None: 879 self.output.write( 880 "WARNING: your terminal doesn't support cursor position requests (CPR).\r\n" 881 ) 882 self.output.flush() /srv/public/kliem/sage/local/lib/python3.7/site-packages/prompt_toolkit/buffer.py in new_coroutine(*a=(), **kw={'complete_event': CompleteEvent(text_inserted=False, completion_requested=True), 'insert_common_part': True, 'select_first': False, 'select_last': False}) 1839 running = False 1840 1841 @wraps(coroutine) 1842 async def new_coroutine(*a: Any, **kw: Any) -> Any: 1843 nonlocal running 1844 1845 # Don't start a new function, if the previous is still in progress. 1846 if running: 1847 return 1848 1849 running = True 1850 1851 try: 1852 while True: 1853 try: -> 1854 await coroutine(*a, **kw) global coroutine = undefined a = () kw = {'select_first': False, 'select_last': False, 'insert_common_part': True, 'complete_event': CompleteEvent(text_inserted=False, completion_requested=True)} 1855 except _Retry: 1856 continue 1857 else: 1858 return None 1859 finally: 1860 running = False 1861 1862 return cast(_T, new_coroutine) 1863 1864 1865 class _Retry(Exception): 1866 " Retry in `_only_one_at_a_time`. " 1867 1868 1869 def indent(buffer: Buffer, from_row: int, to_row: int, count: int = 1) -> None: /srv/public/kliem/sage/local/lib/python3.7/site-packages/prompt_toolkit/buffer.py in async_completer(select_first=False, select_last=False, insert_common_part=True, complete_event=CompleteEvent(text_inserted=False, completion_requested=True)) 1669 1670 # Don't complete when we already have completions. 1671 if self.complete_state or not self.completer: 1672 return 1673 1674 # Create an empty CompletionState. 1675 complete_state = CompletionState(original_document=self.document) 1676 self.complete_state = complete_state 1677 1678 def proceed() -> bool: 1679 """ Keep retrieving completions. Input text has not yet changed 1680 while generating completions. """ 1681 return self.complete_state == complete_state 1682 1683 async for completion in self.completer.get_completions_async( -> 1684 document, complete_event document = Document('P = pol', 7) complete_event = CompleteEvent(text_inserted=False, completion_requested=True) 1685 ): 1686 complete_state.completions.append(completion) 1687 self.on_completions_changed.fire() 1688 1689 # If the input text changes, abort. 1690 if not proceed(): 1691 break 1692 1693 completions = complete_state.completions 1694 1695 # When there is only one completion, which has nothing to add, ignore it. 1696 if len(completions) == 1 and completion_does_nothing( 1697 document, completions[0] 1698 ): 1699 del completions[:] /srv/public/kliem/sage/local/lib/python3.7/site-packages/prompt_toolkit/completion/base.py in get_completions_async(self=DynamicCompleter(), document=Document('P = pol', 7), complete_event=CompleteEvent(text_inserted=False, completion_requested=True)) 255 def __init__(self, get_completer: Callable[[], Optional[Completer]]) -> None: 256 self.get_completer = get_completer 257 258 def get_completions( 259 self, document: Document, complete_event: CompleteEvent 260 ) -> Iterable[Completion]: 261 completer = self.get_completer() or DummyCompleter() 262 return completer.get_completions(document, complete_event) 263 264 async def get_completions_async( 265 self, document: Document, complete_event: CompleteEvent 266 ) -> AsyncGenerator[Completion, None]: 267 completer = self.get_completer() or DummyCompleter() 268 269 async for completion in completer.get_completions_async( --> 270 document, complete_event document = Document('P = pol', 7) complete_event = CompleteEvent(text_inserted=False, completion_requested=True) 271 ): 272 yield completion 273 274 def __repr__(self) -> str: 275 return "DynamicCompleter(%r -> %r)" % (self.get_completer, self.get_completer()) 276 277 278 class _MergedCompleter(Completer): 279 """ 280 Combine several completers into one. 281 """ 282 283 def __init__(self, completers: Sequence[Completer]) -> None: 284 self.completers = completers 285 /srv/public/kliem/sage/local/lib/python3.7/site-packages/prompt_toolkit/completion/base.py in get_completions_async(self=, document=Document('P = pol', 7), complete_event=CompleteEvent(text_inserted=False, completion_requested=True)) 181 :param document: :class:`~prompt_toolkit.document.Document` instance. 182 :param complete_event: :class:`.CompleteEvent` instance. 183 """ 184 while False: 185 yield 186 187 async def get_completions_async( 188 self, document: Document, complete_event: CompleteEvent 189 ) -> AsyncGenerator[Completion, None]: 190 """ 191 Asynchronous generator for completions. (Probably, you won't have to 192 override this.) 193 194 Asynchronous generator of :class:`.Completion` objects. 195 """ --> 196 for item in self.get_completions(document, complete_event): item = undefined self.get_completions = > document = Document('P = pol', 7) complete_event = CompleteEvent(text_inserted=False, completion_requested=True) 197 yield item 198 199 200 class ThreadedCompleter(Completer): 201 """ 202 Wrapper that runs the `get_completions` generator in a thread. 203 204 (Use this to prevent the user interface from becoming unresponsive if the 205 generation of completions takes too much time.) 206 207 The completions will be displayed as soon as they are produced. The user 208 can already select a completion, even if not all completions are displayed. 209 """ 210 211 def __init__(self, completer: Completer) -> None: /srv/public/kliem/sage/local/lib/python3.7/site-packages/IPython/terminal/ptutils.py in get_completions(self=, document=Document('P = pol', 7), complete_event=CompleteEvent(text_inserted=False, completion_requested=True)) 101 return 102 # Some bits of our completion system may print stuff (e.g. if a module 103 # is imported). This context manager ensures that doesn't interfere with 104 # the prompt. 105 106 with patch_stdout(), provisionalcompleter(): 107 body = document.text 108 cursor_row = document.cursor_position_row 109 cursor_col = document.cursor_position_col 110 cursor_position = document.cursor_position 111 offset = cursor_to_position(body, cursor_row, cursor_col) 112 try: 113 yield from self._get_completions(body, offset, cursor_position, self.ipy_completer) 114 except Exception as e: 115 from traceback import print_tb --> 116 print_tb(e) print_tb = e = undefined 117 118 @staticmethod 119 def _get_completions(body, offset, cursor_position, ipyc): 120 """ 121 Private equivalent of get_completions() use only for unit_testing. 122 """ 123 debug = getattr(ipyc, 'debug', False) 124 completions = _deduplicate_completions( 125 body, ipyc.completions(body, offset)) 126 for c in completions: 127 if not c.text: 128 # Guard against completion machinery giving us an empty string. 129 continue 130 text = unicodedata.normalize('NFC', c.text) 131 # When the first character of the completion has a zero length, /usr/lib/python3.7/traceback.py in print_tb(tb=TypeError("__init__() got an unexpected keyword argument 'column'"), limit=None, file=None) 38 """ 39 return StackSummary.from_list(extracted_list).format() 40 41 # 42 # Printing and Extracting Tracebacks. 43 # 44 45 def print_tb(tb, limit=None, file=None): 46 """Print up to 'limit' stack trace entries from the traceback 'tb'. 47 48 If 'limit' is omitted or None, all entries are printed. If 'file' 49 is omitted or None, the output goes to sys.stderr; otherwise 50 'file' should be an open file or file-like object with a write() 51 method. 52 """ ---> 53 print_list(extract_tb(tb, limit=limit), file=file) global print_list = global extract_tb = tb = TypeError("__init__() got an unexpected keyword argument 'column'") limit = None file = None 54 55 def format_tb(tb, limit=None): 56 """A shorthand for 'format_list(extract_tb(tb, limit))'.""" 57 return extract_tb(tb, limit=limit).format() 58 59 def extract_tb(tb, limit=None): 60 """ 61 Return a StackSummary object representing a list of 62 pre-processed entries from traceback. 63 64 This is useful for alternate formatting of stack traces. If 65 'limit' is omitted or None, all entries are extracted. A 66 pre-processed stack trace entry is a FrameSummary object 67 containing attributes filename, lineno, name, and line 68 representing the information that is usually printed for a stack /usr/lib/python3.7/traceback.py in extract_tb(tb=TypeError("__init__() got an unexpected keyword argument 'column'"), limit=None) 57 return extract_tb(tb, limit=limit).format() 58 59 def extract_tb(tb, limit=None): 60 """ 61 Return a StackSummary object representing a list of 62 pre-processed entries from traceback. 63 64 This is useful for alternate formatting of stack traces. If 65 'limit' is omitted or None, all entries are extracted. A 66 pre-processed stack trace entry is a FrameSummary object 67 containing attributes filename, lineno, name, and line 68 representing the information that is usually printed for a stack 69 trace. The line is a string with leading and trailing 70 whitespace stripped; if the source is not available it is None. 71 """ ---> 72 return StackSummary.extract(walk_tb(tb), limit=limit) global StackSummary.extract = > global walk_tb = tb = TypeError("__init__() got an unexpected keyword argument 'column'") limit = None 73 74 # 75 # Exception formatting and output. 76 # 77 78 _cause_message = ( 79 "\nThe above exception was the direct cause " 80 "of the following exception:\n\n") 81 82 _context_message = ( 83 "\nDuring handling of the above exception, " 84 "another exception occurred:\n\n") 85 86 87 def print_exception(etype, value, tb, limit=None, file=None, chain=True): /usr/lib/python3.7/traceback.py in extract(klass=, frame_gen=, limit=None, lookup_lines=True, capture_locals=False) 329 :param capture_locals: If True, the local variables from each frame will 330 be captured as object representations into the FrameSummary. 331 """ 332 if limit is None: 333 limit = getattr(sys, 'tracebacklimit', None) 334 if limit is not None and limit < 0: 335 limit = 0 336 if limit is not None: 337 if limit >= 0: 338 frame_gen = itertools.islice(frame_gen, limit) 339 else: 340 frame_gen = collections.deque(frame_gen, maxlen=-limit) 341 342 result = klass() 343 fnames = set() --> 344 for f, lineno in frame_gen: f = undefined lineno = undefined frame_gen = 345 co = f.f_code 346 filename = co.co_filename 347 name = co.co_name 348 349 fnames.add(filename) 350 linecache.lazycache(filename, f.f_globals) 351 # Must defer line lookups until we have called checkcache. 352 if capture_locals: 353 f_locals = f.f_locals 354 else: 355 f_locals = None 356 result.append(FrameSummary( 357 filename, lineno, name, lookup_line=False, locals=f_locals)) 358 for filename in fnames: 359 linecache.checkcache(filename) /usr/lib/python3.7/traceback.py in walk_tb(tb=TypeError("__init__() got an unexpected keyword argument 'column'")) 294 """ 295 if f is None: 296 f = sys._getframe().f_back.f_back 297 while f is not None: 298 yield f, f.f_lineno 299 f = f.f_back 300 301 302 def walk_tb(tb): 303 """Walk a traceback yielding the frame and line number for each frame. 304 305 This will follow tb.tb_next (and thus is in the opposite order to 306 walk_stack). Usually used with StackSummary.extract. 307 """ 308 while tb is not None: --> 309 yield tb.tb_frame, tb.tb_lineno tb.tb_frame = undefined tb.tb_lineno = undefined 310 tb = tb.tb_next 311 312 313 _RECURSIVE_CUTOFF = 3 # Also hardcoded in traceback.c. 314 315 class StackSummary(list): 316 """A stack of frames.""" 317 318 @classmethod 319 def extract(klass, frame_gen, *, limit=None, lookup_lines=True, 320 capture_locals=False): 321 """Create a StackSummary from a traceback or stack object. 322 323 :param frame_gen: A generator that yields (frame, lineno) tuples to 324 include in the stack. AttributeError: 'TypeError' object has no attribute 'tb_frame' *************************************************************************** History of session input: *** Last line of input (may not be in above history): get_ipython().run_line_magic('colors', 'Linux')