Skip to content

IPython 9 logfile causes crash #14825

@adavis444

Description

@adavis444

Running ipython with --logfile or --logappend causes a crash in ipython>=9
e.g. ipython --logfile=log.txt

This is failing due to the following error:

  File "/usr/local/lib/python3.13/site-packages/IPython/core/interactiveshell.py", line 817, in init_logstart
    self.magic('logstart %s' % self.logfile)
    ^^^^^^^^^^
AttributeError: 'TerminalInteractiveShell' object has no attribute 'magic'

Using docker for reproducibility
docker pull python@sha256:385ccb8304f6330738a6d9e6fa0bd7608e006da7e15bc52b33b0398e1ba4a15b
(digest matches current latest tag)

Installing ipython==9.0.1 and running with --logfile=log.txt with verbose crash:

docker run --rm python@sha256:385ccb8304f6330738a6d9e6fa0bd7608e006da7e15bc52b33b0398e1ba4a15b \
        sh -c \
        'pip install -qq ipython
        ipython --logfile=log.txt --BaseIPythonApplication.verbose_crash=True
        cat /root/.ipython/Crash_report_ipython.txt'
Details
---------------------------------------------------------------------------
---------------------------------------------------------------------------
AttributeError                     Python 3.13.2: /usr/local/bin/python3.13
                                                   Thu Mar  6 19:37:39 2025
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.
File /usr/local/bin/ipython:8
      1 #!/usr/local/bin/python3.13
      2 # -*- coding: utf-8 -*-
      3 import re
      4 import sys
      5 from IPython import start_ipython
      6 if __name__ == '__main__':
      7     sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
----> 8     sys.exit(start_ipython())

File /usr/local/lib/python3.13/site-packages/IPython/__init__.py:139, in start_ipython(argv=None, **kwargs={})
    113 def start_ipython(argv=None, **kwargs):
    114     """Launch a normal IPython instance (as opposed to embedded)
    115
    116     `IPython.embed()` puts a shell in a particular calling scope,
   (...)    136         allowing configuration of the instance (see :ref:`terminal_options`).
    137     """
    138     from IPython.terminal.ipapp import launch_new_instance
--> 139     return launch_new_instance(argv=argv, **kwargs)
        launch_new_instance = <bound method Application.launch_instance of <class 'IPython.terminal.ipapp.TerminalIPythonApp'>>
        argv = None
        kwargs = {}
File /usr/local/lib/python3.13/site-packages/traitlets/config/application.py:1074, in Application.launch_instance(cls=<class 'IPython.terminal.ipapp.TerminalIPythonApp'>, argv=None, **kwargs={})
   1067 @classmethod
   1068 def launch_instance(cls, argv: ArgvType = None, **kwargs: t.Any) -> None:
   1069     """Launch a global instance of this Application
   1070
   1071     If a global instance already exists, this reinitializes and starts it
   1072     """
   1073     app = cls.instance(**kwargs)
-> 1074     app.initialize(argv)
        app = <IPython.terminal.ipapp.TerminalIPythonApp object at 0xffffa354b620>
        argv = None   1075     app.start()

File /usr/local/lib/python3.13/site-packages/traitlets/config/application.py:118, in catch_config_error.<locals>.inner(app=<IPython.terminal.ipapp.TerminalIPythonApp object>, *args=(None,), **kwargs={})
    115 @functools.wraps(method)
    116 def inner(app: Application, *args: t.Any, **kwargs: t.Any) -> t.Any:
    117     try:
--> 118         return method(app, *args, **kwargs)
        method = <function TerminalIPythonApp.initialize at 0xffffa318f1a0>
        app = <IPython.terminal.ipapp.TerminalIPythonApp object at 0xffffa354b620>
        args = (None,)
        kwargs = {}    119     except (TraitError, ArgumentError) as e:
    120         app.log.fatal("Bad config encountered during initialization: %s", e)
    121         app.log.debug("Config at the time: %s", app.config)
    122         app.exit(1)

File /usr/local/lib/python3.13/site-packages/IPython/terminal/ipapp.py:286, in TerminalIPythonApp.initialize(self=<IPython.terminal.ipapp.TerminalIPythonApp object>, argv=None)
    274 @catch_config_error
    275 def initialize(self, argv=None):
    276     """Do actions after construct, but before starting the app."""
    277     super(TerminalIPythonApp, self).initialize(argv)
    278     if self.subapp is not None:
    279         # don't bother initializing further, starting subapp
    280         return
    281     # print(self.extra_args)
    282     if self.extra_args and not self.something_to_run:
    283         self.file_to_run = self.extra_args[0]
    284     self.init_path()
    285     # create the shell
--> 286     self.init_shell()
        self = <IPython.terminal.ipapp.TerminalIPythonApp object at 0xffffa354b620>    287     # and draw the banner
    288     self.init_banner()
    289     # Now a variety of things that happen after the banner is printed.
    290     self.init_gui_pylab()
    291     self.init_extensions()
    292     self.init_code()

File /usr/local/lib/python3.13/site-packages/IPython/terminal/ipapp.py:300, in TerminalIPythonApp.init_shell(self=<IPython.terminal.ipapp.TerminalIPythonApp object>)
    294 def init_shell(self):
    295     """initialize the InteractiveShell instance"""
    296     # Create an InteractiveShell instance.
    297     # shell.display_banner should always be False for the terminal
    298     # based app, because we call shell.show_banner() by hand below
    299     # so the banner shows *before* all extension loading stuff.
--> 300     self.shell = self.interactive_shell_class.instance(parent=self,
        self = <IPython.terminal.ipapp.TerminalIPythonApp object at 0xffffa354b620>    301                     profile_dir=self.profile_dir,
    302                     ipython_dir=self.ipython_dir, user_ns=self.user_ns)
    303     self.shell.configurables.append(self)

File /usr/local/lib/python3.13/site-packages/traitlets/config/configurable.py:583, in SingletonConfigurable.instance(cls=<class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>, *args=(), **kwargs={'ipython_dir': '/root/.ipython', 'parent': <IPython.terminal.ipapp.TerminalIPythonApp object>, 'profile_dir': <IPython.core.profiledir.ProfileDir object>, 'user_ns': None})
    553 @classmethod
    554 def instance(cls: type[CT], *args: t.Any, **kwargs: t.Any) -> CT:
    555     """Returns a global instance of this class.
    556
    557     This method create a new instance if none have previously been created
   (...)    579         True
    580     """
    581     # Create and save the instance
    582     if cls._instance is None:
--> 583         inst = cls(*args, **kwargs)
        cls = <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
        args = ()
        kwargs = {'parent': <IPython.terminal.ipapp.TerminalIPythonApp object at 0xffffa354b620>, 'profile_dir': <IPython.core.profiledir.ProfileDir object at 0xffffa354bcb0>, 'ipython_dir': '/root/.ipython', 'user_ns': None}    584         # Now make sure that the instance will also be returned by
    585         # parent classes' _instance attribute.
    586         for subclass in cls._walk_mro():
    587             subclass._instance = inst
    589     if isinstance(cls._instance, cls):
    590         return cls._instance
    591     else:
    592         raise MultipleInstanceError(
    593             f"An incompatible sibling of '{cls.__name__}' is already instantiated"
    594             f" as singleton: {type(cls._instance).__name__}"
    595         )

File /usr/local/lib/python3.13/site-packages/IPython/terminal/interactiveshell.py:977, in TerminalInteractiveShell.__init__(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>, *args=(), **kwargs={'ipython_dir': '/root/.ipython', 'parent': <IPython.terminal.ipapp.TerminalIPythonApp object>, 'profile_dir': <IPython.core.profiledir.ProfileDir object>, 'user_ns': None})
    976 def __init__(self, *args, **kwargs) -> None:
--> 977     super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
        self = <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0xffffa31bc590>
        args = ()
        kwargs = {'parent': <IPython.terminal.ipapp.TerminalIPythonApp object at 0xffffa354b620>, 'profile_dir': <IPython.core.profiledir.ProfileDir object at 0xffffa354bcb0>, 'ipython_dir': '/root/.ipython', 'user_ns': None}
        TerminalInteractiveShell = <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>    978     self._set_autosuggestions(self.autosuggestions_provider)
    979     self.init_prompt_toolkit_cli()
    980     self.init_term_title()
    981     self.keep_running = True
    982     self._set_formatter(self.autoformatter)

File /usr/local/lib/python3.13/site-packages/IPython/core/interactiveshell.py:650, in InteractiveShell.__init__(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>, ipython_dir='/root/.ipython', profile_dir=<IPython.core.profiledir.ProfileDir object>, user_module=None, user_ns=None, custom_exceptions=((), None), **kwargs={'parent': <IPython.terminal.ipapp.TerminalIPythonApp object>})
    632 self.init_logger()
    633 self.init_builtins()
    635 # The following was in post_config_initialization
    636 self.raw_input_original = input
    637 self.init_completer()
    638 # TODO: init_io() needs to happen before init_traceback handlers
    639 # because the traceback handlers hardcode the stdout/stderr streams.
    640 # This logic in in debugger.Pdb and should eventually be changed.
    641 self.init_io()
    642 self.init_traceback_handlers(custom_exceptions)
    643 self.init_prompts()
    644 self.init_display_formatter()
    645 self.init_display_pub()
    646 self.init_data_pub()
    647 self.init_displayhook()
    648 self.init_magics()
    649 self.init_alias()
--> 650 self.init_logstart()
        self = <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0xffffa31bc590>    651 self.init_pdb()
    652 self.init_extension_manager()
    653 self.init_payload()
    654 self.events.trigger('shell_initialized', self)
    655 atexit.register(self.atexit_operations)
    657 # The trio runner is used for running Trio in the foreground thread. It
    658 # is different from `_trio_runner(async_fn)` in `async_helpers.py`
    659 # which calls `trio.run()` for every cell. This runner runs all cells
    660 # inside a single Trio event loop. If used, it is set from
    661 # `ipykernel.kernelapp`.
    662 self.trio_runner = None

File /usr/local/lib/python3.13/site-packages/IPython/core/interactiveshell.py:817, in InteractiveShell.init_logstart(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>)
    811 def init_logstart(self):
    812     """Initialize logging in case it was requested at the command line.
    813     """
    814     if self.logappend:
    815         self.magic('logstart %s append' % self.logappend)
    816     elif self.logfile:
--> 817         self.magic('logstart %s' % self.logfile)
        self = <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0xffffa31bc590>    818     elif self.logstart:
    819         self.magic('logstart')

AttributeError: 'TerminalInteractiveShell' object has no attribute 'magic'

**********************************************************************

Oops, ipython crashed. We do our best to make it stable, but...

A crash report was automatically generated with the following information:
  - A verbatim copy of the crash traceback.
  - A copy of your input history during this session.
  - Data on your current ipython configuration.

It was left in the file named:
	'/root/.ipython/Crash_report_ipython.txt'
If you can email this file to the developers, the information in it will help
them in understanding and correcting the problem.

You can mail it to: The IPython Development Team at ipython-dev@python.org
with the subject 'ipython Crash Report'.

If you want to do it now, the following command will work (under Unix):
mail -s 'ipython Crash Report' ipython-dev@python.org < /root/.ipython/Crash_report_ipython.txt

In your email, please also include information about:
- The operating system under which the crash happened: Linux, macOS, Windows,
  other, and which exact version (for example: Ubuntu 16.04.3, macOS 10.13.2,
  Windows 10 Pro), and whether it is 32-bit or 64-bit;
- How ipython was installed: using pip or conda, from GitHub, as part of
  a Docker container, or other, providing more detail if possible;
- How to reproduce the crash: what exact sequence of instructions can one
  input to get the same crash? Ideally, find a minimal yet complete sequence
  of instructions that yields the crash.

To ensure accurate tracking of this issue, please file a report about it at:
https://github.com/ipython/ipython/issues

Hit <Enter> to quit (your terminal may close):Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/IPython/core/application.py", line 288, in excepthook
    return self.crash_handler(etype, evalue, tb)
           ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/IPython/core/crashhandler.py", line 206, in __call__
    builtin_mod.input("Hit <Enter> to quit (your terminal may close):")
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
EOFError: EOF when reading a line

Original exception was:
Traceback (most recent call last):
  File "/usr/local/bin/ipython", line 8, in <module>
    sys.exit(start_ipython())
             ~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/IPython/__init__.py", line 139, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/traitlets/config/application.py", line 1074, in launch_instance
    app.initialize(argv)
    ~~~~~~~~~~~~~~^^^^^^
  File "/usr/local/lib/python3.13/site-packages/traitlets/config/application.py", line 118, in inner
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/IPython/terminal/ipapp.py", line 286, in initialize
    self.init_shell()
    ~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/IPython/terminal/ipapp.py", line 300, in init_shell
    self.shell = self.interactive_shell_class.instance(parent=self,
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
                    profile_dir=self.profile_dir,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    ipython_dir=self.ipython_dir, user_ns=self.user_ns)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/traitlets/config/configurable.py", line 583, in instance
    inst = cls(*args, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/IPython/terminal/interactiveshell.py", line 977, in __init__
    super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/IPython/core/interactiveshell.py", line 650, in __init__
    self.init_logstart()
    ~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/IPython/core/interactiveshell.py", line 817, in init_logstart
    self.magic('logstart %s' % self.logfile)
    ^^^^^^^^^^
AttributeError: 'TerminalInteractiveShell' object has no attribute 'magic'
***************************************************************************

IPython post-mortem report

{'commit_hash': 'd64897cf0',
 'commit_source': 'installation',
 'default_encoding': 'utf-8',
 'ipython_path': '/usr/local/lib/python3.13/site-packages/IPython',
 'ipython_version': '9.0.1',
 'os_name': 'posix',
 'platform': 'Linux-6.10.14-linuxkit-aarch64-with-glibc2.36',
 'sys_executable': '/usr/local/bin/python3.13',
 'sys_platform': 'linux',
 'sys_version': '3.13.2 (main, Feb 25 2025, 21:31:02) [GCC 12.2.0]'}

***************************************************************************

Application name: ipython

Current user configuration structure:

{'BaseIPythonApplication': {'verbose_crash': True},
 'TerminalInteractiveShell': {'logfile': 'log.txt'}}

***************************************************************************

Crash traceback:

---------------------------------------------------------------------------
---------------------------------------------------------------------------
AttributeError                     Python 3.13.2: /usr/local/bin/python3.13
                                                   Thu Mar  6 19:37:39 2025
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.
File /usr/local/bin/ipython:8
      1 #!/usr/local/bin/python3.13
      2 # -*- coding: utf-8 -*-
      3 import re
      4 import sys
      5 from IPython import start_ipython
      6 if __name__ == '__main__':
      7     sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
----> 8     sys.exit(start_ipython())

File /usr/local/lib/python3.13/site-packages/IPython/__init__.py:139, in start_ipython(argv=None, **kwargs={})
    113 def start_ipython(argv=None, **kwargs):
    114     """Launch a normal IPython instance (as opposed to embedded)
    115
    116     `IPython.embed()` puts a shell in a particular calling scope,
   (...)    136         allowing configuration of the instance (see :ref:`terminal_options`).
    137     """
    138     from IPython.terminal.ipapp import launch_new_instance
--> 139     return launch_new_instance(argv=argv, **kwargs)
        launch_new_instance = <bound method Application.launch_instance of <class 'IPython.terminal.ipapp.TerminalIPythonApp'>>
        argv = None
        kwargs = {}
File /usr/local/lib/python3.13/site-packages/traitlets/config/application.py:1074, in Application.launch_instance(cls=<class 'IPython.terminal.ipapp.TerminalIPythonApp'>, argv=None, **kwargs={})
   1067 @classmethod
   1068 def launch_instance(cls, argv: ArgvType = None, **kwargs: t.Any) -> None:
   1069     """Launch a global instance of this Application
   1070
   1071     If a global instance already exists, this reinitializes and starts it
   1072     """
   1073     app = cls.instance(**kwargs)
-> 1074     app.initialize(argv)
        app = <IPython.terminal.ipapp.TerminalIPythonApp object at 0xffffa354b620>
        argv = None   1075     app.start()

File /usr/local/lib/python3.13/site-packages/traitlets/config/application.py:118, in catch_config_error.<locals>.inner(app=<IPython.terminal.ipapp.TerminalIPythonApp object>, *args=(None,), **kwargs={})
    115 @functools.wraps(method)
    116 def inner(app: Application, *args: t.Any, **kwargs: t.Any) -> t.Any:
    117     try:
--> 118         return method(app, *args, **kwargs)
        method = <function TerminalIPythonApp.initialize at 0xffffa318f1a0>
        app = <IPython.terminal.ipapp.TerminalIPythonApp object at 0xffffa354b620>
        args = (None,)
        kwargs = {}    119     except (TraitError, ArgumentError) as e:
    120         app.log.fatal("Bad config encountered during initialization: %s", e)
    121         app.log.debug("Config at the time: %s", app.config)
    122         app.exit(1)

File /usr/local/lib/python3.13/site-packages/IPython/terminal/ipapp.py:286, in TerminalIPythonApp.initialize(self=<IPython.terminal.ipapp.TerminalIPythonApp object>, argv=None)
    274 @catch_config_error
    275 def initialize(self, argv=None):
    276     """Do actions after construct, but before starting the app."""
    277     super(TerminalIPythonApp, self).initialize(argv)
    278     if self.subapp is not None:
    279         # don't bother initializing further, starting subapp
    280         return
    281     # print(self.extra_args)
    282     if self.extra_args and not self.something_to_run:
    283         self.file_to_run = self.extra_args[0]
    284     self.init_path()
    285     # create the shell
--> 286     self.init_shell()
        self = <IPython.terminal.ipapp.TerminalIPythonApp object at 0xffffa354b620>    287     # and draw the banner
    288     self.init_banner()
    289     # Now a variety of things that happen after the banner is printed.
    290     self.init_gui_pylab()
    291     self.init_extensions()
    292     self.init_code()

File /usr/local/lib/python3.13/site-packages/IPython/terminal/ipapp.py:300, in TerminalIPythonApp.init_shell(self=<IPython.terminal.ipapp.TerminalIPythonApp object>)
    294 def init_shell(self):
    295     """initialize the InteractiveShell instance"""
    296     # Create an InteractiveShell instance.
    297     # shell.display_banner should always be False for the terminal
    298     # based app, because we call shell.show_banner() by hand below
    299     # so the banner shows *before* all extension loading stuff.
--> 300     self.shell = self.interactive_shell_class.instance(parent=self,
        self = <IPython.terminal.ipapp.TerminalIPythonApp object at 0xffffa354b620>    301                     profile_dir=self.profile_dir,
    302                     ipython_dir=self.ipython_dir, user_ns=self.user_ns)
    303     self.shell.configurables.append(self)

File /usr/local/lib/python3.13/site-packages/traitlets/config/configurable.py:583, in SingletonConfigurable.instance(cls=<class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>, *args=(), **kwargs={'ipython_dir': '/root/.ipython', 'parent': <IPython.terminal.ipapp.TerminalIPythonApp object>, 'profile_dir': <IPython.core.profiledir.ProfileDir object>, 'user_ns': None})
    553 @classmethod
    554 def instance(cls: type[CT], *args: t.Any, **kwargs: t.Any) -> CT:
    555     """Returns a global instance of this class.
    556
    557     This method create a new instance if none have previously been created
   (...)    579         True
    580     """
    581     # Create and save the instance
    582     if cls._instance is None:
--> 583         inst = cls(*args, **kwargs)
        cls = <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
        args = ()
        kwargs = {'parent': <IPython.terminal.ipapp.TerminalIPythonApp object at 0xffffa354b620>, 'profile_dir': <IPython.core.profiledir.ProfileDir object at 0xffffa354bcb0>, 'ipython_dir': '/root/.ipython', 'user_ns': None}    584         # Now make sure that the instance will also be returned by
    585         # parent classes' _instance attribute.
    586         for subclass in cls._walk_mro():
    587             subclass._instance = inst
    589     if isinstance(cls._instance, cls):
    590         return cls._instance
    591     else:
    592         raise MultipleInstanceError(
    593             f"An incompatible sibling of '{cls.__name__}' is already instantiated"
    594             f" as singleton: {type(cls._instance).__name__}"
    595         )

File /usr/local/lib/python3.13/site-packages/IPython/terminal/interactiveshell.py:977, in TerminalInteractiveShell.__init__(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>, *args=(), **kwargs={'ipython_dir': '/root/.ipython', 'parent': <IPython.terminal.ipapp.TerminalIPythonApp object>, 'profile_dir': <IPython.core.profiledir.ProfileDir object>, 'user_ns': None})
    976 def __init__(self, *args, **kwargs) -> None:
--> 977     super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
        self = <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0xffffa31bc590>
        args = ()
        kwargs = {'parent': <IPython.terminal.ipapp.TerminalIPythonApp object at 0xffffa354b620>, 'profile_dir': <IPython.core.profiledir.ProfileDir object at 0xffffa354bcb0>, 'ipython_dir': '/root/.ipython', 'user_ns': None}
        TerminalInteractiveShell = <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>    978     self._set_autosuggestions(self.autosuggestions_provider)
    979     self.init_prompt_toolkit_cli()
    980     self.init_term_title()
    981     self.keep_running = True
    982     self._set_formatter(self.autoformatter)

File /usr/local/lib/python3.13/site-packages/IPython/core/interactiveshell.py:650, in InteractiveShell.__init__(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>, ipython_dir='/root/.ipython', profile_dir=<IPython.core.profiledir.ProfileDir object>, user_module=None, user_ns=None, custom_exceptions=((), None), **kwargs={'parent': <IPython.terminal.ipapp.TerminalIPythonApp object>})
    632 self.init_logger()
    633 self.init_builtins()
    635 # The following was in post_config_initialization
    636 self.raw_input_original = input
    637 self.init_completer()
    638 # TODO: init_io() needs to happen before init_traceback handlers
    639 # because the traceback handlers hardcode the stdout/stderr streams.
    640 # This logic in in debugger.Pdb and should eventually be changed.
    641 self.init_io()
    642 self.init_traceback_handlers(custom_exceptions)
    643 self.init_prompts()
    644 self.init_display_formatter()
    645 self.init_display_pub()
    646 self.init_data_pub()
    647 self.init_displayhook()
    648 self.init_magics()
    649 self.init_alias()
--> 650 self.init_logstart()
        self = <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0xffffa31bc590>    651 self.init_pdb()
    652 self.init_extension_manager()
    653 self.init_payload()
    654 self.events.trigger('shell_initialized', self)
    655 atexit.register(self.atexit_operations)
    657 # The trio runner is used for running Trio in the foreground thread. It
    658 # is different from `_trio_runner(async_fn)` in `async_helpers.py`
    659 # which calls `trio.run()` for every cell. This runner runs all cells
    660 # inside a single Trio event loop. If used, it is set from
    661 # `ipykernel.kernelapp`.
    662 self.trio_runner = None

File /usr/local/lib/python3.13/site-packages/IPython/core/interactiveshell.py:817, in InteractiveShell.init_logstart(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>)
    811 def init_logstart(self):
    812     """Initialize logging in case it was requested at the command line.
    813     """
    814     if self.logappend:
    815         self.magic('logstart %s append' % self.logappend)
    816     elif self.logfile:
--> 817         self.magic('logstart %s' % self.logfile)
        self = <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0xffffa31bc590>    818     elif self.logstart:
    819         self.magic('logstart')

AttributeError: 'TerminalInteractiveShell' object has no attribute 'magic'

***************************************************************************

History of session input:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions