Hello, I need help figuring out what's going on when I am preparing Sage for SageMathCell.
When the script is at https://github.com/sagemath/sagecell/blob/master/contrib/vm/container_manager.py#L445 trying to pipe some commands into a freshly compiled Sage it crashes. The crash report is attached and the problem seems to be with a wrong or absent terminal (given that it is done by a script in screen). After the build there is "Sage starts OK" message and if I try to connect via interactive terminal and execute commands by hand everything is fine. Exactly the same setup was also going without crashes for 7.3, so it is some recent change/upgrade. Thank you! Andrey -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
*************************************************************************** IPython post-mortem report {'commit_hash': u'1ba246d', 'commit_source': 'installation', 'default_encoding': 'UTF-8', 'ipython_path': '/home/sc_serv/sage/local/lib/python2.7/site-packages/IPython', 'ipython_version': '5.0.0', 'os_name': 'posix', 'platform': 'Linux-4.4.0-36-generic-x86_64-with-debian-stretch-sid', 'sys_executable': '/home/sc_serv/sage/local/bin/python', 'sys_platform': 'linux2', 'sys_version': '2.7.10 (default, Oct 20 2016, 05:24:29) \n[GCC 5.4.0 20160609]'} *************************************************************************** *************************************************************************** Crash traceback: --------------------------------------------------------------------------- --------------------------------------------------------------------------- error Python 2.7.10: /home/sc_serv/sage/local/bin/python Thu Oct 20 06:21:36 2016 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. /home/sc_serv/sage/src/bin/sage-ipython in <module>() 1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 """ 4 Sage IPython startup script. 5 """ 6 7 from sage.repl.interpreter import SageTerminalApp 8 9 app = SageTerminalApp.instance() 10 app.initialize() ---> 11 app.start() global app.start = <bound method SageTerminalApp.start of <sage.repl.interpreter.SageTerminalApp object at 0x7f7da6a59e90>> /home/sc_serv/sage/local/lib/python2.7/site-packages/IPython/terminal/ipapp.py in start(self=<sage.repl.interpreter.SageTerminalApp object>) 333 if self.log_level <= logging.INFO: print() 334 335 def _pylab_changed(self, name, old, new): 336 """Replace --pylab='inline' with --pylab='auto'""" 337 if new == 'inline': 338 warnings.warn("'inline' not available as pylab backend, " 339 "using 'auto' instead.") 340 self.pylab = 'auto' 341 342 def start(self): 343 if self.subapp is not None: 344 return self.subapp.start() 345 # perform any prexec steps: 346 if self.interact: 347 self.log.debug("Starting IPython's mainloop...") --> 348 self.shell.mainloop() self.shell.mainloop = <bound method SageTerminalInteractiveShell.mainloop of <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7f7da0b22b90>> 349 else: 350 self.log.debug("IPython not interactive...") 351 352 def load_default_config(ipython_dir=None): 353 """Load the default config file from the default ipython_dir. 354 355 This is useful for embedded shells. 356 """ 357 if ipython_dir is None: 358 ipython_dir = get_ipython_dir() 359 360 profile_dir = os.path.join(ipython_dir, 'profile_default') 361 362 config = Config() 363 for cf in Application._load_config_files("ipython_config", path=profile_dir): /home/sc_serv/sage/local/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py in mainloop(self=<sage.repl.interpreter.SageTerminalInteractiveShell object>, display_banner=<object object>) 387 if (not self.confirm_exit) \ 388 or self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'): 389 self.ask_exit() 390 391 else: 392 if code: 393 self.run_cell(code, store_history=True) 394 395 def mainloop(self, display_banner=DISPLAY_BANNER_DEPRECATED): 396 # An extra layer of protection in case someone mashing Ctrl-C breaks 397 # out of our internal code. 398 if display_banner is not DISPLAY_BANNER_DEPRECATED: 399 warn('mainloop `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2) 400 while True: 401 try: --> 402 self.interact() self.interact = <bound method SageTerminalInteractiveShell.interact of <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7f7da0b22b90>> 403 break 404 except KeyboardInterrupt: 405 print("\nKeyboardInterrupt escaped interact()\n") 406 407 if hasattr(self, '_eventloop'): 408 self._eventloop.close() 409 410 _inputhook = None 411 def inputhook(self, context): 412 if self._inputhook is not None: 413 self._inputhook(context) 414 415 def enable_gui(self, gui=None): 416 if gui: 417 self._inputhook = get_inputhook_func(gui) /home/sc_serv/sage/local/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py in interact(self=<sage.repl.interpreter.SageTerminalInteractiveShell object>, display_banner=<object object>) 370 371 def pre_prompt(self): 372 if self.rl_next_input: 373 self.pt_cli.application.buffer.text = cast_unicode_py2(self.rl_next_input) 374 self.rl_next_input = None 375 376 def interact(self, display_banner=DISPLAY_BANNER_DEPRECATED): 377 378 if display_banner is not DISPLAY_BANNER_DEPRECATED: 379 warn('interact `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2) 380 381 while self.keep_running: 382 print(self.separate_in, end='') 383 384 try: --> 385 code = self.prompt_for_code() code = undefined self.prompt_for_code = <bound method SageTerminalInteractiveShell.prompt_for_code of <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7f7da0b22b90>> 386 except EOFError: 387 if (not self.confirm_exit) \ 388 or self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'): 389 self.ask_exit() 390 391 else: 392 if code: 393 self.run_cell(code, store_history=True) 394 395 def mainloop(self, display_banner=DISPLAY_BANNER_DEPRECATED): 396 # An extra layer of protection in case someone mashing Ctrl-C breaks 397 # out of our internal code. 398 if display_banner is not DISPLAY_BANNER_DEPRECATED: 399 warn('mainloop `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2) 400 while True: /home/sc_serv/sage/local/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py in prompt_for_code(self=<sage.repl.interpreter.SageTerminalInteractiveShell object>) 306 processor=HighlightMatchingBracketProcessor(chars='[](){}'), 307 filter=HasFocus(DEFAULT_BUFFER) & ~IsDone() & 308 Condition(lambda cli: self.highlight_matching_brackets))], 309 } 310 311 def _update_layout(self): 312 """ 313 Ask for a re computation of the application layout, if for example , 314 some configuration options have changed. 315 """ 316 if self._pt_app: 317 self._pt_app.layout = create_prompt_layout(**self._layout_options()) 318 319 def prompt_for_code(self): 320 document = self.pt_cli.run( --> 321 pre_run=self.pre_prompt, reset_current_buffer=True) global pre_run = undefined self.pre_prompt = <bound method SageTerminalInteractiveShell.pre_prompt of <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7f7da0b22b90>> global reset_current_buffer = undefined global True = undefined 322 return document.text 323 324 def init_io(self): 325 if sys.platform not in {'win32', 'cli'}: 326 return 327 328 import win_unicode_console 329 import colorama 330 331 win_unicode_console.enable() 332 colorama.init() 333 334 # For some reason we make these wrappers around stdout/stderr. 335 # For now, we need to reset them so all output gets coloured. 336 # https://github.com/ipython/ipython/issues/8669 /home/sc_serv/sage/local/lib/python2.7/site-packages/prompt_toolkit/interface.py in run(self=<prompt_toolkit.interface.CommandLineInterface object>, reset_current_buffer=True, pre_run=<bound method SageTerminalInteractiveShell.pre_p...interpreter.SageTerminalInteractiveShell object>>) 370 place. This allows custom initialisation. 371 """ 372 assert pre_run is None or callable(pre_run) 373 374 try: 375 self._is_running = True 376 377 self.on_start.fire() 378 self.reset(reset_current_buffer=reset_current_buffer) 379 380 # Call pre_run. 381 if pre_run: 382 pre_run() 383 384 # Run eventloop in raw mode. --> 385 with self.input.raw_mode(): self.input.raw_mode = <bound method StdinInput.raw_mode of StdinInput(stdin=<open file '<stdin>', mode 'r' at 0x7f7da6b820c0>)> 386 self.renderer.request_absolute_cursor_position() 387 self._redraw() 388 389 self.eventloop.run(self.input, self.create_eventloop_callbacks()) 390 finally: 391 # Clean up renderer. (This will leave the alternate screen, if we use 392 # that.) 393 394 # If exit/abort haven't been called set, but another exception was 395 # thrown instead for some reason, make sure that we redraw in exit 396 # mode. 397 if not self.is_done: 398 self._exit_flag = True 399 self._redraw() 400 /home/sc_serv/sage/local/lib/python2.7/site-packages/prompt_toolkit/input.py in raw_mode(self=StdinInput(stdin=<open file '<stdin>', mode 'r' at 0x7f7da6b820c0>)) 54 Context manager that turns the input into cooked mode. 55 """ 56 57 58 class StdinInput(Input): 59 """ 60 Simple wrapper around stdin. 61 """ 62 def __init__(self, stdin=None): 63 self.stdin = stdin or sys.stdin 64 65 def __repr__(self): 66 return 'StdinInput(stdin=%r)' % (self.stdin,) 67 68 def raw_mode(self): ---> 69 return raw_mode(self.stdin.fileno()) global raw_mode = <class 'prompt_toolkit.terminal.vt100_input.raw_mode'> self.stdin.fileno = <built-in method fileno of file object at 0x7f7da6b820c0> 70 71 def cooked_mode(self): 72 return cooked_mode(self.stdin.fileno()) 73 74 def fileno(self): 75 return self.stdin.fileno() 76 77 def read(self): 78 return self.stdin.read() 79 80 81 class PipeInput(Input): 82 """ 83 Input that is send through a pipe. 84 This is useful if we want to send the input programatically into the /home/sc_serv/sage/local/lib/python2.7/site-packages/prompt_toolkit/terminal/vt100_input.py in __init__(self=<prompt_toolkit.terminal.vt100_input.raw_mode object>, fileno=0) 394 Wrapper around ``feed`` and ``flush``. 395 """ 396 self.feed(data) 397 self.flush() 398 399 400 class raw_mode(object): 401 """ 402 :: 403 404 with raw_mode(stdin): 405 ''' the pseudo-terminal stdin is now used in raw mode ''' 406 """ 407 def __init__(self, fileno): 408 self.fileno = fileno --> 409 self.attrs_before = termios.tcgetattr(fileno) self.attrs_before = undefined global termios.tcgetattr = <built-in function tcgetattr> fileno = 0 410 411 def __enter__(self): 412 # NOTE: On os X systems, using pty.setraw() fails. Therefor we are using this: 413 newattr = termios.tcgetattr(self.fileno) 414 newattr[tty.LFLAG] = self._patch(newattr[tty.LFLAG]) 415 termios.tcsetattr(self.fileno, termios.TCSANOW, newattr) 416 417 # Put the terminal in cursor mode. (Instead of application mode.) 418 os.write(self.fileno, b'\x1b[?1l') 419 420 def _patch(self, attrs): 421 return attrs & ~(termios.ECHO | termios.ICANON | termios.IEXTEN | termios.ISIG) 422 423 def __exit__(self, *a, **kw): 424 termios.tcsetattr(self.fileno, termios.TCSANOW, self.attrs_before) error: (25, 'Inappropriate ioctl for device') *************************************************************************** History of session input: *** Last line of input (may not be in above history):