<p>powerline-statusがipython&gt; = 7.0.0でクラッシュする</p>

作成日 2018年10月05日  ·  41コメント  ·  ソース: powerline/powerline

IPython用のPowerlineプラグインにより、バージョン7.0.0および7.0.1の起動時にクラッシュします。 IPythonバージョン6.5.0でうまく機能します。 詳細なクラッシュレポートをコメントとして添付します。 以下は私のIPython構成です:

# Enable the Powerline prompt
from powerline.bindings.ipython.since_5 import PowerlinePrompts
c.TerminalInteractiveShell.simple_prompt = False
c.TerminalInteractiveShell.prompts_class = PowerlinePrompts

## Shortcut style to use at the prompt. 'vi' or 'emacs'.
c.TerminalInteractiveShell.editing_mode = 'vi'

## Set the editor used by IPython (default to $EDITOR/vi/notepad).
c.TerminalInteractiveShell.editor = 'vim'

c.TerminalInteractiveShell.highlighting_style = 'monokai'
cipython bug

最も参考になるコメント

変更がリリースされるまで、 developブランチをチェックアウトして変更を取得します。 masterよりも安定性が低い可能性がありますが、電力線プロンプトをまったく使用できないことよりも優れています。

pip install --user 'git+https://github.com/powerline/powerline.git@develop#powerline'

次に、ipython構成で、次のようにsince_5since_7に変更します。

from powerline.bindings.ipython.since_7 import PowerlinePrompts
c.TerminalInteractiveShell.simple_prompt = False
c.TerminalInteractiveShell.prompts_class = PowerlinePrompts

全てのコメント41件

$ ipython                                                                                                                                                            master| ✔
Python 3.6.6 (default, Oct  3 2018, 13:39:52)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.0.1 -- An enhanced Interactive Python. Type '?' for help.

---------------------------------------------------------------------------
---------------------------------------------------------------------------
TypeErrorPython 3.6.6: /home/local/ANT/dylone/.pyenv/versions/3.6.6/bin/python3.6
                                                   Fri Oct  5 12:15:31 2018
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.
~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/application/application.py in _run_async2()
    650                     f = From(_run_async())
--> 651                     result = yield f
        result = undefined
        f = <prompt_toolkit.eventloop.future.Future object at 0x7f06ce70c240>
    652                 finally:

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/eventloop/coroutine.py in step_next(f=None)
     85             if f is None:
---> 86                 new_f = coroutine.send(None)
        global new_f = undefined
        global coroutine.send = undefined
     87             else:

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/application/application.py in _run_async()
    593                     self._request_absolute_cursor_position()
--> 594                     self._redraw()
        global self._redraw = undefined
    595

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/application/application.py in _redraw(self=<prompt_toolkit.application.application.Application object>, render_as_done=False)
    442                 else:
--> 443                     self.renderer.render(self, self.layout)
        self.renderer.render = <bound method Renderer.render of <prompt_toolkit.renderer.Renderer object at 0x7f06ce5eb320>>
        self = <prompt_toolkit.application.application.Application object at 0x7f06ce749710>
        self.layout = Layout(<prompt_toolkit.layout.containers.HSplit object at 0x7f06ce736e48>, current_window=Window(content=<BufferControl buffer=<Buffer(name='DEFAULT_BUFFER', text='') at 139667210131160> at 139667210247472>))
    444

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/renderer.py in render(self=<prompt_toolkit.renderer.Renderer object>, app=<prompt_toolkit.application.application.Application object>, layout=Layout(<prompt_toolkit.layout.containers.HSplit ...ext='') at 139667210131160> at 139667210247472>)), is_done=False)
    549         # (But note that we still use _last_screen to calculate the height.)
--> 550         if (self.style.invalidation_hash() != self._last_style_hash or
        self.style.invalidation_hash = <bound method _MergedStyle.invalidation_hash of <prompt_toolkit.styles.style._MergedStyle object at 0x7f06ce5eb208>>
        self._last_style_hash = None
        app.style_transformation.invalidation_hash = <bound method _MergedStyleTransformation.invalidation_hash of <prompt_toolkit.styles.style_transformation._MergedStyleTransformation object at 0x7f06ce7490b8>>
        self._last_transformation_hash = None
        app.color_depth = 'DEPTH_8_BIT'
        self._last_color_depth = None
    551                 app.style_transformation.invalidation_hash() != self._last_transformation_hash or

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/styles/style.py in invalidation_hash(self=<prompt_toolkit.styles.style._MergedStyle object>)
    371     def invalidation_hash(self):
--> 372         return tuple(s.invalidation_hash() for s in self.styles)
        global tuple = undefined
        global s.invalidation_hash = undefined
        global s = undefined
        self.styles = [<prompt_toolkit.styles.style._MergedStyle object at 0x7f06ce6538d0>, <prompt_toolkit.styles.base.DynamicStyle object at 0x7f06ce63ea90>, <prompt_toolkit.styles.base.DynamicStyle object at 0x7f06ce5eb2b0>]

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/styles/style.py in <genexpr>(.0=<list_iterator object>)
    371     def invalidation_hash(self):
--> 372         return tuple(s.invalidation_hash() for s in self.styles)
        global tuple = undefined
        s.invalidation_hash = <bound method DynamicStyle.invalidation_hash of <prompt_toolkit.styles.base.DynamicStyle object at 0x7f06ce5eb2b0>>
        s = <prompt_toolkit.styles.base.DynamicStyle object at 0x7f06ce5eb2b0>
        global self.styles = undefined

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/styles/base.py in invalidation_hash(self=<prompt_toolkit.styles.base.DynamicStyle object>)
    139     def invalidation_hash(self):
--> 140         return (self.get_style() or self._dummy).invalidation_hash()
        self.get_style = <function Application._create_merged_style.<locals>.<lambda> at 0x7f06ce63b730>
        self._dummy.invalidation_hash = <bound method DummyStyle.invalidation_hash of <prompt_toolkit.styles.base.DummyStyle object at 0x7f06ce5eb278>>
    141

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/styles/base.py in invalidation_hash(self=<prompt_toolkit.styles.base.DynamicStyle object>)
    139     def invalidation_hash(self):
--> 140         return (self.get_style() or self._dummy).invalidation_hash()
        self.get_style = <function PromptSession._create_application.<locals>.<lambda> at 0x7f06ce660598>
        self._dummy.invalidation_hash = <bound method DummyStyle.invalidation_hash of <prompt_toolkit.styles.base.DummyStyle object at 0x7f06ce748e80>>
    141

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/styles/base.py in invalidation_hash(self=<prompt_toolkit.styles.base.DynamicStyle object>)
    139     def invalidation_hash(self):
--> 140         return (self.get_style() or self._dummy).invalidation_hash()
        self.get_style = <function TerminalInteractiveShell.init_prompt_toolkit_cli.<locals>.<lambda> at 0x7f06ce832bf8>
        self._dummy.invalidation_hash = <bound method DummyStyle.invalidation_hash of <prompt_toolkit.styles.base.DummyStyle object at 0x7f06ce821630>>
    141

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/powerline/renderers/ipython/since_5.py in invalidation_hash(self=<powerline.renderers.ipython.since_5.PowerlinePromptStyle object>)
     78         def invalidation_hash(self):
---> 79                 return super(PowerlinePromptStyle, self).invalidation_hash() + 1
        global super = undefined
        global PowerlinePromptStyle = <class 'powerline.renderers.ipython.since_5.PowerlinePromptStyle'>
        self.invalidation_hash = <bound method PowerlinePromptStyle.invalidation_hash of <powerline.renderers.ipython.since_5.PowerlinePromptStyle object at 0x7f06ce5f8cf8>>
     80

TypeError: can only concatenate tuple (not "int") to tuple

During handling of the above exception, another exception occurred:

---------------------------------------------------------------------------
AssertionErrorPython 3.6.6: /home/local/ANT/dylone/.pyenv/versions/3.6.6/bin/python3.6
                                                   Fri Oct  5 12:15:31 2018
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.
~/.pyenv/versions/3.6.6/bin/ipython in <module>
      1 #!/home/local/ANT/dylone/.pyenv/versions/3.6.6/bin/python3.6
      2
      3 # -*- coding: utf-8 -*-
      4 import re
      5 import sys
      6
      7 from IPython import start_ipython
      8
      9 if __name__ == '__main__':
     10     sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
---> 11     sys.exit(start_ipython())
        global sys.exit = <built-in function exit>
        global start_ipython = <function start_ipython at 0x7f06cf554378>

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/IPython/__init__.py in start_ipython(argv=None, **kwargs={})
    110     This is a public API method, and will survive implementation changes.
    111
    112     Parameters
    113     ----------
    114
    115     argv : list or None, optional
    116         If unspecified or None, IPython will parse command-line options from sys.argv.
    117         To prevent any command-line parsing, pass an empty list: `argv=[]`.
    118     user_ns : dict, optional
    119         specify this dictionary to initialize the IPython user namespace with particular values.
    120     kwargs : various, optional
    121         Any other kwargs will be passed to the Application constructor,
    122         such as `config`.
    123     """
    124     from IPython.terminal.ipapp import launch_new_instance
--> 125     return launch_new_instance(argv=argv, **kwargs)
        launch_new_instance = <bound method Application.launch_instance of <class 'IPython.terminal.ipapp.TerminalIPythonApp'>>
        argv = None
        kwargs = {}
    126
    127 def start_kernel(argv=None, **kwargs):
    128     """Launch a normal IPython kernel instance (as opposed to embedded)
    129
    130     `IPython.embed_kernel()` puts a shell in a particular calling scope,
    131     such as a function or method for debugging purposes,
    132     which is often not desirable.
    133
    134     `start_kernel()` does full, regular IPython initialization,
    135     including loading startup files, configuration, etc.
    136     much of which is skipped by `embed()`.
    137
    138     Parameters
    139     ----------
    140

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/traitlets/config/application.py in launch_instance(cls=<class 'IPython.terminal.ipapp.TerminalIPythonApp'>, argv=None, **kwargs={})
    643             lines.append(cls.class_config_section())
    644         return '\n'.join(lines)
    645
    646     def exit(self, exit_status=0):
    647         self.log.debug("Exiting application: %s" % self.name)
    648         sys.exit(exit_status)
    649
    650     <strong i="5">@classmethod</strong>
    651     def launch_instance(cls, argv=None, **kwargs):
    652         """Launch a global instance of this Application
    653
    654         If a global instance already exists, this reinitializes and starts it
    655         """
    656         app = cls.instance(**kwargs)
    657         app.initialize(argv)
--> 658         app.start()
        app.start = <bound method TerminalIPythonApp.start of <IPython.terminal.ipapp.TerminalIPythonApp object at 0x7f06d6aae080>>
    659
    660 #-----------------------------------------------------------------------------
    661 # utility functions, for convenience
    662 #-----------------------------------------------------------------------------
    663
    664 def boolean_flag(name, configurable, set_help='', unset_help=''):
    665     """Helper for building basic --trait, --no-trait flags.
    666
    667     Parameters
    668     ----------
    669
    670     name : str
    671         The name of the flag.
    672     configurable : str
    673         The 'Class.trait' string of the trait to be set/unset with the flag

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/IPython/terminal/ipapp.py in start(self=<IPython.terminal.ipapp.TerminalIPythonApp object>)
    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 = <bound method TerminalInteractiveShell.mainloop of <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0x7f06d25a8a20>>
    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()

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py in mainloop(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>, display_banner=<object object>)
    457                 if (not self.confirm_exit) \
    458                         or self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'):
    459                     self.ask_exit()
    460
    461             else:
    462                 if code:
    463                     self.run_cell(code, store_history=True)
    464
    465     def mainloop(self, display_banner=DISPLAY_BANNER_DEPRECATED):
    466         # An extra layer of protection in case someone mashing Ctrl-C breaks
    467         # out of our internal code.
    468         if display_banner is not DISPLAY_BANNER_DEPRECATED:
    469             warn('mainloop `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2)
    470         while True:
    471             try:
--> 472                 self.interact()
        self.interact = <bound method TerminalInteractiveShell.interact of <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0x7f06d25a8a20>>
    473                 break
    474             except KeyboardInterrupt as e:
    475                 print("\n%s escaped interact()\n" % type(e).__name__)
    476             finally:
    477                 # An interrupt during the eventloop will mess up the
    478                 # internal state of the prompt_toolkit library.
    479                 # Stopping the eventloop fixes this, see
    480                 # https://github.com/ipython/ipython/pull/9867
    481                 if hasattr(self, '_eventloop'):
    482                     self._eventloop.stop()
    483
    484     _inputhook = None
    485     def inputhook(self, context):
    486         if self._inputhook is not None:
    487             self._inputhook(context)

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py in interact(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>, display_banner=<object object>)
    440     def ask_exit(self):
    441         self.keep_running = False
    442
    443     rl_next_input = None
    444
    445     def interact(self, display_banner=DISPLAY_BANNER_DEPRECATED):
    446
    447         if display_banner is not DISPLAY_BANNER_DEPRECATED:
    448             warn('interact `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2)
    449
    450         self.keep_running = True
    451         while self.keep_running:
    452             print(self.separate_in, end='')
    453
    454             try:
--> 455                 code = self.prompt_for_code()
        code = undefined
        self.prompt_for_code = <bound method TerminalInteractiveShell.prompt_for_code of <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0x7f06d25a8a20>>
    456             except EOFError:
    457                 if (not self.confirm_exit) \
    458                         or self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'):
    459                     self.ask_exit()
    460
    461             else:
    462                 if code:
    463                     self.run_cell(code, store_history=True)
    464
    465     def mainloop(self, display_banner=DISPLAY_BANNER_DEPRECATED):
    466         # An extra layer of protection in case someone mashing Ctrl-C breaks
    467         # out of our internal code.
    468         if display_banner is not DISPLAY_BANNER_DEPRECATED:
    469             warn('mainloop `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2)
    470         while True:

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py in prompt_for_code(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>)
    369                             Condition(lambda: self.highlight_matching_brackets))],
    370                 'inputhook': self.inputhook,
    371                 }
    372
    373     def prompt_for_code(self):
    374         if self.rl_next_input:
    375             default = self.rl_next_input
    376             self.rl_next_input = None
    377         else:
    378             default = ''
    379
    380         with patch_stdout(raw=True):
    381             text = self.pt_app.prompt(
    382                 default=default,
    383 #                pre_run=self.pre_prompt,# reset_current_buffer=True,
--> 384                 **self._extra_prompt_options())
        self._extra_prompt_options = <bound method TerminalInteractiveShell._extra_prompt_options of <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0x7f06d25a8a20>>
    385         return text
    386
    387     def enable_win_unicode_console(self):
    388         if sys.version_info >= (3, 6):
    389             # Since PEP 528, Python uses the unicode APIs for the Windows
    390             # console by default, so WUC shouldn't be needed.
    391             return
    392
    393         import win_unicode_console
    394         win_unicode_console.enable()
    395
    396     def init_io(self):
    397         if sys.platform not in {'win32', 'cli'}:
    398             return
    399

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/shortcuts/prompt.py in prompt(self=<prompt_toolkit.shortcuts.prompt.PromptSession object>, message=<function TerminalInteractiveShell._extra_prompt_options.<locals>.get_message>, default='', editing_mode=None, refresh_interval=None, vi_mode=None, lexer=<IPython.terminal.ptutils.IPythonPTLexer object>, 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=<function TerminalInteractiveShell._extra_prompt_options.<locals>.<lambda>>, wrap_lines=None, enable_history_search=None, search_ignore_case=None, complete_while_typing=None, validate_while_typing=None, complete_style='MULTI_COLUMN', auto_suggest=None, validator=None, clipboard=None, mouse_support=None, input_processors=[ConditionalProcessor(processor=<prompt_toolkit.l...pt_options.<locals>.<lambda> at 0x7f06ce63bea0>))], reserve_space_for_menu=6, enable_system_prompt=None, enable_suspend=None, enable_open_in_editor=None, tempfile_suffix=None, inputhook=<bound method TerminalInteractiveShell.inputhook...nteractiveshell.TerminalInteractiveShell object>>, async_=False, accept_default=False, pre_run=None)
    716
    717         def run_sync():
    718             with self._auto_refresh_context():
    719                 self.default_buffer.reset(Document(self.default))
    720                 return self.app.run(inputhook=self.inputhook, pre_run=pre_run2)
    721
    722         def run_async():
    723             with self._auto_refresh_context():
    724                 self.default_buffer.reset(Document(self.default))
    725                 result = yield From(self.app.run_async(pre_run=pre_run2))
    726                 raise Return(result)
    727
    728         if async_:
    729             return ensure_future(run_async())
    730         else:
--> 731             return run_sync()
        run_sync = <function PromptSession.prompt.<locals>.run_sync at 0x7f06ce832c80>
    732
    733     <strong i="6">@property</strong>
    734     def editing_mode(self):
    735         return self.app.editing_mode
    736
    737     @editing_mode.setter
    738     def editing_mode(self, value):
    739         self.app.editing_mode = value
    740
    741     def _get_default_buffer_control_height(self):
    742         # If there is an autocompletion menu to be shown, make sure that our
    743         # layout has at least a minimal height in order to display it.
    744         if (self.completer is not None and
    745                 self.complete_style != CompleteStyle.READLINE_LIKE):
    746             space = self.reserve_space_for_menu

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/shortcuts/prompt.py in run_sync()
    705         def pre_run2():
    706             if pre_run:
    707                 pre_run()
    708
    709             if accept_default:
    710                 # Validate and handle input. We use `call_from_executor` in
    711                 # order to run it "soon" (during the next iteration of the
    712                 # event loop), instead of right now. Otherwise, it won't
    713                 # display the default value.
    714                 get_event_loop().call_from_executor(
    715                     self.default_buffer.validate_and_handle)
    716
    717         def run_sync():
    718             with self._auto_refresh_context():
    719                 self.default_buffer.reset(Document(self.default))
--> 720                 return self.app.run(inputhook=self.inputhook, pre_run=pre_run2)
        global self.app.run = undefined
        global inputhook = undefined
        global self.inputhook = undefined
        global pre_run = undefined
        global pre_run2 = undefined
    721
    722         def run_async():
    723             with self._auto_refresh_context():
    724                 self.default_buffer.reset(Document(self.default))
    725                 result = yield From(self.app.run_async(pre_run=pre_run2))
    726                 raise Return(result)
    727
    728         if async_:
    729             return ensure_future(run_async())
    730         else:
    731             return run_sync()
    732
    733     <strong i="7">@property</strong>
    734     def editing_mode(self):
    735         return self.app.editing_mode

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/application/application.py in run(self=<prompt_toolkit.application.application.Application object>, pre_run=<function PromptSession.prompt.<locals>.pre_run2>, set_exception_handler=True, inputhook=<bound method TerminalInteractiveShell.inputhook...nteractiveshell.TerminalInteractiveShell object>>)
    683             def print_exception():
    684                 # Print output. Similar to 'loop.default_exception_handler',
    685                 # but don't use logger. (This works better on Python 2.)
    686                 print('\nUnhandled exception in event loop:')
    687                 print(formatted_tb)
    688                 print('Exception %s' % (context.get('exception'), ))
    689
    690                 yield From(_do_wait_for_enter('Press ENTER to continue...'))
    691             run_coroutine_in_terminal(print_exception)
    692
    693         if set_exception_handler:
    694             # Run with patched exception handler.
    695             previous_exc_handler = loop.get_exception_handler()
    696             loop.set_exception_handler(handle_exception)
    697             try:
--> 698                 return run()
        run = <function Application.run.<locals>.run at 0x7f06ce5f9158>
    699             finally:
    700                 loop.set_exception_handler(previous_exc_handler)
    701         else:
    702             run()
    703
    704     def cpr_not_supported_callback(self):
    705         """
    706         Called when we don't receive the cursor position response in time.
    707         """
    708         if not self.input.responds_to_cpr:
    709             return  # We know about this already.
    710
    711         def in_terminal():
    712             self.output.write(
    713                 "WARNING: your terminal doesn't support cursor position requests (CPR).\r\n")

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/application/application.py in run()
    657
    658     def run(self, pre_run=None, set_exception_handler=True, inputhook=None):
    659         """
    660         A blocking 'run' call that waits until the UI is finished.
    661
    662         :param set_exception_handler: When set, in case of an exception, go out
    663             of the alternate screen and hide the application, display the
    664             exception, and wait for the user to press ENTER.
    665         :param inputhook: None or a callable that takes an `InputHookContext`.
    666         """
    667         loop = get_event_loop()
    668
    669         def run():
    670             f = self.run_async(pre_run=pre_run)
    671             run_until_complete(f, inputhook=inputhook)
--> 672             return f.result()
        f.result = <bound method Future.result of <prompt_toolkit.eventloop.future.Future object at 0x7f06ce718978>>
    673
    674         def handle_exception(context):
    675             " Print the exception, using run_in_terminal. "
    676             # For Python 2: we have to get traceback at this point, because
    677             # we're still in the 'except:' block of the event loop where the
    678             # traceback is still available. Moving this code in the
    679             # 'print_exception' coroutine will loose the exception.
    680             tb = get_traceback_from_context(context)
    681             formatted_tb = ''.join(format_tb(tb))
    682
    683             def print_exception():
    684                 # Print output. Similar to 'loop.default_exception_handler',
    685                 # but don't use logger. (This works better on Python 2.)
    686                 print('\nUnhandled exception in event loop:')
    687                 print(formatted_tb)

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/eventloop/future.py in result(self=<prompt_toolkit.eventloop.future.Future object>)
    134             # Activate the original task context (and application) again.
    135             with context(self._ctx_id):
    136                 # They should be called in order.
    137                 for cb in done_callbacks:
    138                     cb(self)
    139
    140         self.loop.call_from_executor(call_them_all)
    141
    142     def result(self):
    143         " Return the result this future represents. "
    144         if not self._done:
    145             raise InvalidStateError
    146
    147         self._retrieved_result = True
    148         if self._exception:
--> 149             raise self._exception
        self._exception = AssertionError()
    150         else:
    151             return self._result
    152
    153     def exception(self):
    154         " Return the exception that was set on this future. "
    155         if not self._done:
    156             raise InvalidStateError
    157
    158         self._retrieved_result = True
    159         return self._exception
    160
    161     def done(self):
    162         """
    163         Return True if the future is done. Done means either that a result /
    164         exception are available, or that the future was cancelled.

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/eventloop/coroutine.py in step_next(f=<prompt_toolkit.eventloop.future.Future object>)
     75     # (If `step_next` had a direct reference to `result_f` and there is a
     76     # future that references `step_next`, then sometimes it won't be cleaned up
     77     # immediately. - I'm not sure how exactly, but in that case it requires the
     78     # garbage collector, because refcounting isn't sufficient.)
     79     ref = _FutureRef(result_f)
     80
     81     # Loop through the generator.
     82     def step_next(f=None):
     83         " Execute next step of the coroutine."
     84         try:
     85             if f is None:
     86                 new_f = coroutine.send(None)
     87             else:
     88                 exc = f.exception()
     89                 if exc:
---> 90                     new_f = coroutine.throw(exc)
        global new_f = undefined
        global coroutine.throw = undefined
        exc = TypeError('can only concatenate tuple (not "int") to tuple',)
     91                 else:
     92                     new_f = coroutine.send(f.result())
     93         except StopIteration as e:
     94             # Stop coroutine. Make sure that a result has been set in the future,
     95             # this will call the callbacks. (Also, don't take any result from
     96             # StopIteration, it has already been set using `raise Return()`.
     97             if not ref.future.done():
     98                 ref.future.set_result(None)
     99                 ref.forget()
    100         except Return as e:
    101             ref.future.set_result(e.value)
    102             ref.forget()
    103         except BaseException as e:
    104             ref.future.set_exception(e)
    105             ref.forget()

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/prompt_toolkit/application/application.py in _run_async2()
    638                             if previous_run_in_terminal_f:
    639                                 yield From(previous_run_in_terminal_f)
    640
    641                             # Store unprocessed input as typeahead for next time.
    642                             store_typeahead(self.input, self.key_processor.empty_queue())
    643
    644                 raise Return(result)
    645
    646         def _run_async2():
    647             self._is_running = True
    648             with set_app(self):
    649                 try:
    650                     f = From(_run_async())
    651                     result = yield f
    652                 finally:
--> 653                     assert not self._is_running
        global self._is_running = undefined
    654                 raise Return(result)
    655
    656         return ensure_future(_run_async2())
    657
    658     def run(self, pre_run=None, set_exception_handler=True, inputhook=None):
    659         """
    660         A blocking 'run' call that waits until the UI is finished.
    661
    662         :param set_exception_handler: When set, in case of an exception, go out
    663             of the alternate screen and hide the application, display the
    664             exception, and wait for the user to press ENTER.
    665         :param inputhook: None or a callable that takes an `InputHookContext`.
    666         """
    667         loop = get_event_loop()
    668

AssertionError:

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

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:
        '/home/local/ANT/dylone/.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 [email protected]
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' [email protected] < /home/local/ANT/dylone/.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):
[1]    16729 exit 1     ipython

また、ドキュメントのデフォルト構成でクラッシュします。

from powerline.bindings.ipython.since_5 import PowerlinePrompts
c = get_config()
c.TerminalInteractiveShell.simple_prompt = False
c.TerminalInteractiveShell.prompts_class = PowerlinePrompts

例外:

Traceback (most recent call last):
  File "/usr/local/Cellar/ipython/7.0.1/libexec/vendor/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 635, in _run_async2
    result = yield f
  File "/usr/local/Cellar/ipython/7.0.1/libexec/vendor/lib/python3.7/site-packages/prompt_toolkit/eventloop/coroutine.py", line 86, in step_next
    new_f = coroutine.send(None)
  File "/usr/local/Cellar/ipython/7.0.1/libexec/vendor/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 587, in _run_async
    self._redraw()
  File "/usr/local/Cellar/ipython/7.0.1/libexec/vendor/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 436, in _redraw
    self.renderer.render(self, self.layout)
  File "/usr/local/Cellar/ipython/7.0.1/libexec/vendor/lib/python3.7/site-packages/prompt_toolkit/renderer.py", line 535, in render
    if (self.style.invalidation_hash() != self._last_style_hash or
  File "/usr/local/Cellar/ipython/7.0.1/libexec/vendor/lib/python3.7/site-packages/prompt_toolkit/styles/style.py", line 371, in invalidation_hash
    return tuple(s.invalidation_hash() for s in self.styles)
  File "/usr/local/Cellar/ipython/7.0.1/libexec/vendor/lib/python3.7/site-packages/prompt_toolkit/styles/style.py", line 371, in <genexpr>
    return tuple(s.invalidation_hash() for s in self.styles)
  File "/usr/local/Cellar/ipython/7.0.1/libexec/vendor/lib/python3.7/site-packages/prompt_toolkit/styles/base.py", line 140, in invalidation_hash
    return (self.get_style() or self._dummy).invalidation_hash()
  File "/usr/local/Cellar/ipython/7.0.1/libexec/vendor/lib/python3.7/site-packages/prompt_toolkit/styles/base.py", line 140, in invalidation_hash
    return (self.get_style() or self._dummy).invalidation_hash()
  File "/usr/local/Cellar/ipython/7.0.1/libexec/vendor/lib/python3.7/site-packages/prompt_toolkit/styles/base.py", line 140, in invalidation_hash
    return (self.get_style() or self._dummy).invalidation_hash()
  File "/usr/local/lib/python3.7/site-packages/powerline/renderers/ipython/since_5.py", line 79, in invalidation_hash
    return super(PowerlinePromptStyle, self).invalidation_hash() + 1
TypeError: can only concatenate tuple (not "int") to tuple

そう
ipython>=7.0.0prompt_toolkit>=2.0.0,<2.1.0
ipython<7.0.0prompt_toolkit>=1.0.15,<2.0.0

prompt_toolkit <2.0.0では、 invalidation_hash常にstrまたはint返しますが、最後のバージョンではtupleも返す場合があります。

回避策として、これを使用します。

diff --git a/powerline/renderers/ipython/since_5.py b/powerline/renderers/ipython/since_5.py
index 8a26da72..6719fd09 100644
--- a/powerline/renderers/ipython/since_5.py
+++ b/powerline/renderers/ipython/since_5.py
@@ -76,7 +76,7 @@ class PowerlinePromptStyle(DynamicStyle):
                return PowerlineStyleDict(fallback)

        def invalidation_hash(self):
-           return super(PowerlinePromptStyle, self).invalidation_hash() + 1
+         return (h + 1 for h in tuple(super(PowerlinePromptStyle, self).invalidation_hash()))


 class IPythonPygmentsRenderer(IPythonRenderer):

しかし、これでPRを作成する価値があるかどうかはわかりません。 きちんと見えません。

適切な修正を加えたsince_7.pyタイプのファイルを作成する価値はありますか?

これはできますか? これにより、電力線を使用できなくなります。

上記の修正により、電力線はクラッシュしませんが、修正されません。 のように、表示されるプロンプトは見苦しく、色が変わるはずの場所に「&」が表示されます。

&文字は改行しないスペースのようです( \xa0 ); テーマ設定を介してそれらを無効にすると、通常のスペースに置き換えられます。 ただし、色はまだ変化していないようで、すべてが透明な背景と前景色として#00005fを持っています。

現在のバージョンのiPython(私の場合は7.4)で電力線が壊れていることを確認できます。
@Zebradilによって提案された修正により、iPythonは少なくとも再び使用可能になります(ありがとう!)が-
すでに述べたように、プロンプトを色の代わりに&で飾ります。

IPython7.3.0でこの問題が発生します。 IPythonを使用するには、拡張機能を停止する必要があります。

いつ直しますか~~~

お気軽にどうぞ。 @Zebradilのパッチから始めて、見てみましょう
iPythonプロンプトが&sの数に減る理由。

あなたはこのバグの影響を受ける多くの人々を助けるでしょう。

「色の代わりに&でプロンプトを装飾する」とは何ですか。 のように見える? パッチを使用すると、次のようになります。

2019-04-03-083801_739x255_scrot

そこにはなにも &。

この問題をさらに調査していただきありがとうございます。

そこにはなにも &。

あなたの場合、「&」は「_」に置き換えられました-興味深い、
使用しているシステムに依存しているようです。

Kubuntu18.04でのプロンプトの外観は次のとおりです。

iPython7-powerline

&文字は改行しないスペースのようです( \xa0 ); テーマ設定を介してそれらを無効にすると、通常のスペースに置き換えられます。 ただし、色はまだ変化していないようで、すべてが透明な背景と前景色として#00005fを持っています。

Screenshot_2019-04-03_21-04-52

&に関する問題は、色とは関係のない別の問題だと思います。

あなたの場合、「&」は「_」に置き換えられました-興味深い、
使用しているシステムに依存しているようです。

システムには依存しませんが、のバージョンに依存します
prompt-toolkit:2.0.7から2.0.9にアップグレードしました
そして、すべての「&」は「_」になりました。

これは、2.0.8の新機能です。

  • '&'としてレンダリングする代わりに、改行しないスペースに下線を引きます。

@acgtyrant 2.0.9をインストールしていますか?

色については、 Token.Generic.Prompt後の何かが無視されているように見えます//github.com/powerline/powerline/blob/5d82d544f3366a214732aeb8f781d50ced38ceef/powerline/renderers/ipython/since_5.py#L121

私が理解している限り、すべてのハイライトグループに対して新しいトークンタイプが作成され、 renderers / ipython / since_5.pyで定義されたカスタムDynamicStyleが対応するスタイルを作成することになっています。 ただし、 get_attrs_for_tokenget_token_to_attributes_dict呼び出されないようです。 https://github.com/prompt-toolkit/python-prompt-toolkit/commit/c32f3783a76e6b72d53acda0b6c4a15ef13bed3bを見ると、prompt_toolkitはget_attrs_for_tokenを使用せず、代わりにget_attrs_for_style_str使用していることがわかります

色の問題に対する(非常にハッキーな)解決策があるようです。使用したすべてのハイライトをhlに記録し、prompt_toolkitスタイルの形式のペアに変換して、実装によって既に生成されたスタイルルールにこれらの新しいペアを追加します。

    <strong i="7">@property</strong>
    def style_rules(self):

class PowerlinePromptStyle(DynamicStyle):

Screenshot_2019-04-04_18-41-31
ご覧のとおり、コードをクリーンアップする必要がありますが、機能しているようです。

@ PH111P-うさぎの穴に飛び込んでくれてありがとう!

したがって、両方の新しい問題(色の欠落と「&」/「_」)は、
プロンプトツールキットをバージョン2にアップグレードしますか?

したがって、両方の新しい問題(色の欠落と「&」/「_」)は、
プロンプトツールキットをバージョン2にアップグレードしますか?

そうだと思います、はい。

おそらく、ガイド「prompt_toolkit2.0へのアップグレード」が役に立ちます
必要な変更について説明しているので:

https://python-prompt-toolkit.readthedocs.io/en/master/pages/upgrading.html#pygments -styles-and-token

色修正の実装は、 https://github.com/PH111P/powerline/blob/develop/powerline/renderers/ipython/since_7.pyにあります。
nbspの問題は、構成ファイルでそれらを無効にすることで解決できます( "use_non_breaking_spaces": false設定することにより)。

時間があれば、プルリクエストを書くかもしれません。

@ GHPS2.0.8-1をインストールしました。

カラーフィックスの実装はここにあります

すばらしい-あなたはそれを修正しました。 iPythonとPowerlineが再び使用可能になりました!
時間を割いて整理してくれてありがとう...

VIモードインジケーターを復活させるチャンスはありますか
同様に? 現在欠落しています...

色の修正と構成を追加しましたが、IPythonにまだ_が残っているので、理由がわかりません。

2019-04-05-220405_165x64_scrot

色の修正と構成を追加しましたが、IPythonにまだ_が残っているので、理由がわかりません。

2019-04-05-220405_165x64_scrot

申し訳ありませんが、実際にはそのための構成ファイルを使用することはできません(前述のフラグはグローバルテーマレベルでのみ機能します。個人的には、ソースでnbspをグローバルに無効にしましたが、それは道ではありません)。 nbspを修正するには、ipythonレンダラーを変更する必要があるようです。特に、 class IPythonPygmentsRenderer(IPythonRenderer):次のようなものを追加すると、この問題が修正されるはずです。
(今回は実際にその回避策をテストしましたが、他のものが実際には機能しなかったことを再度申し訳ありません。https://github.com/PH111P/powerline/blob/develop/powerline/renderers/ipython/since_7.pyも参照してください)

    def __init__(self, **kwargs):
        super(IPythonPygmentsRenderer, self).__init__(**kwargs)
        self.character_translations[ord(' ')] = ' '

VIモードインジケーターを復活させるチャンスはありますか
同様に? 現在欠落しています...

その機能を備えたセグメントがないように見えます。 ただし、次のようなものは機能しているようです。これを本格的なセグメントに自由に変換してください(ほとんどのコードは実際のipython実装から恥知らずに盗まれています:https://github.com/ipython/ipython/blob/4f901de17aff2132365fc3741fc5b4b8a9a98dc6 /IPython/terminal/prompts.py#L16):

<strong i="9">@requires_segment_info</strong>
def vi_mode(pl, segment_info):
    ipython = segment_info['ipython']._shell
    if (getattr(ipython.pt_app, 'editing_mode', None) == 'VI'
            and ipython.prompt_includes_vi_mode):
        return str(ipython.pt_app.app.vi_state.input_mode)[3:6]
    else:
        return None

Screenshot_2019-04-06_07-31-01

編集:現在のモードを示しているように見えますが、実際には更新されていないようです:/。 私はipythonでviモードを実際に使用していないことを認めなければならないので、これを実際にテストすることはできません。
編集2 :バインディングを更新することで修正: https

@ PH111P-すごい! すごい仕事!

フィリップ(別名@ PH111P )の素晴らしい仕事を認めながら、 --simple-promptオプションで何かできるかどうか質問したいと思います。

#!since_5.py

$ ipython
Python 2.7.15+ (default, Nov 27 2018, 23:36:35) 
Type "copyright", "credits" or "license" for more information.

IPython 5.8.0.dev -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

 In [1] ▶                                                                                                                                                                                                          
Do you really want to exit ([y]/n)? y
#!since_7.py

$ ipython3
Python 3.6.8 (default, Jan 14 2019, 11:02:34) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.6.0.dev -- An enhanced Interactive Python. Type '?' for help.

 In [1] ▶                                                                                                                                                                                                          
Do you really want to exit ([y]/n)? y



md5-9ccbec5ae4eaf34d991b332b2f93161f



``` bash
#!since_7.py

$ ipython3 --simple-prompt
Python 3.6.8 (default, Jan 14 2019, 11:02:34) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.6.0.dev -- An enhanced Interactive Python. Type '?' for help.

 In [1] ▶

PRはしばらく無人のままだったようです。 これを更新する予定はありますか?

私の知る限り、すべて( --simple-promptを除く)が機能しているように見えるので、@ teracamoが何を指しているのか完全にはわかりません。 (確かに、PRはまだマージされていませんが、これは#2012に関連しているようです。厳密に言えば、PRはまだテストが不足していますが、私が言ったように、すでに使用できるはずです)

現在のバージョンはipython> = 7.0では機能しないため、このPRがマージされる計画があるかどうかについて言及しています。
私はまだPRを試したことがないので、 --simple-promptオプションについては何も言えませんが、マージする予定がない場合は試します。

変更がリリースされるまで、 developブランチをチェックアウトして変更を取得します。 masterよりも安定性が低い可能性がありますが、電力線プロンプトをまったく使用できないことよりも優れています。

pip install --user 'git+https://github.com/powerline/powerline.git@develop#powerline'

次に、ipython構成で、次のようにsince_5since_7に変更します。

from powerline.bindings.ipython.since_7 import PowerlinePrompts
c.TerminalInteractiveShell.simple_prompt = False
c.TerminalInteractiveShell.prompts_class = PowerlinePrompts

リリースされるまでどのくらいかかりますか?

たぶん、新しいリリースが必要です。
最終リリースは2年前です。

新しいリリースをありがとう。 しかし、電力線を2.8-1にアップグレードした後も、このバグが発生しました。 何故かはわからない。



 19:05:12  ~ 
$ ipython                                                                                            otakutyrant  PC
Python 3.8.2 (default, Apr  8 2020, 14:31:25)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.14.0 -- An enhanced Interactive Python. Type '?' for help.

Traceback (most recent call last):
  File "/usr/bin/ipython", line 5, in <module>
    start_ipython()
  File "/usr/lib/python3.8/site-packages/IPython/__init__.py", line 126, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/lib/python3.8/site-packages/traitlets/config/application.py", line 664, in launch_instance
    app.start()
  File "/usr/lib/python3.8/site-packages/IPython/terminal/ipapp.py", line 356, in start
    self.shell.mainloop()
  File "/usr/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 559, in mainloop
    self.interact()
  File "/usr/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 542, in interact
    code = self.prompt_for_code()
  File "/usr/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 468, in prompt_for_code
    text = self.pt_app.prompt(
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py", line 994, in prompt
    return self.app.run(set_exception_handler=set_exception_handler)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 811, in run
    return loop.run_until_complete(
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 778, in run_async
    return await _run_async2()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 760, in _run_async2
    result = await _run_async()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 686, in _run_async
    self._redraw()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 523, in _redraw
    self.context.run(run_in_context)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 509, in run_in_context
    self.renderer.render(self, self.layout)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/renderer.py", line 581, in render
    self.style.invalidation_hash() != self._last_style_hash
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/style.py", line 398, in invalidation_hash
    return tuple(s.invalidation_hash() for s in self.styles)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/style.py", line 398, in <genexpr>
    return tuple(s.invalidation_hash() for s in self.styles)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/base.py", line 177, in invalidation_hash
    return (self.get_style() or self._dummy).invalidation_hash()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/base.py", line 177, in invalidation_hash
    return (self.get_style() or self._dummy).invalidation_hash()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/base.py", line 177, in invalidation_hash
    return (self.get_style() or self._dummy).invalidation_hash()
  File "/usr/lib/python3.8/site-packages/powerline/renderers/ipython/since_5.py", line 79, in invalidation_hash
    return super(PowerlinePromptStyle, self).invalidation_hash() + 1
TypeError: can only concatenate tuple (not "int") to tuple

If you suspect this is an IPython 7.14.0 bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at [email protected]

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True


 19:05:15  ✘  ~ 
$ pacman -Qi powerline                                                                               otakutyrant  PC
Name            : powerline
Version         : 2.8-1
Description     : Statusline plugin for vim, and provides statuslines and prompts for several other applications,
                  including zsh, bash, tmux, IPython, Awesome, i3 and Qtile
Architecture    : x86_64
URL             : https://github.com/powerline/powerline
Licenses        : MIT
Groups          : None
Provides        : None
Depends On      : python-powerline
Optional Deps   : None
Required By     : None
Optional For    : None
Conflicts With  : powerline2  python-powerline<=2.3-1
Replaces        : python-powerline<=2.3-1
Installed Size  : 28.39 KiB
Packager        : Jiachen YANG <[email protected]>
Build Date      : Mon 18 May 2020 01:55:40 PM CST
Install Date    : Tue 19 May 2020 06:55:56 PM CST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature


 19:09:25  ~ 
$                                                                                                    otakutyrant  PC

/usr/lib/python3.8/site-packages/powerline/renderers/ipython/since_7.pyはすでに存在します。

新しいリリースをありがとう。 しかし、電力線を2.8-1にアップグレードした後も、このバグが発生しました。 何故かはわからない。



 19:05:12  ~ 
$ ipython                                                                                            otakutyrant  PC
Python 3.8.2 (default, Apr  8 2020, 14:31:25)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.14.0 -- An enhanced Interactive Python. Type '?' for help.

Traceback (most recent call last):
  File "/usr/bin/ipython", line 5, in <module>
    start_ipython()
  File "/usr/lib/python3.8/site-packages/IPython/__init__.py", line 126, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/lib/python3.8/site-packages/traitlets/config/application.py", line 664, in launch_instance
    app.start()
  File "/usr/lib/python3.8/site-packages/IPython/terminal/ipapp.py", line 356, in start
    self.shell.mainloop()
  File "/usr/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 559, in mainloop
    self.interact()
  File "/usr/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 542, in interact
    code = self.prompt_for_code()
  File "/usr/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 468, in prompt_for_code
    text = self.pt_app.prompt(
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py", line 994, in prompt
    return self.app.run(set_exception_handler=set_exception_handler)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 811, in run
    return loop.run_until_complete(
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 778, in run_async
    return await _run_async2()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 760, in _run_async2
    result = await _run_async()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 686, in _run_async
    self._redraw()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 523, in _redraw
    self.context.run(run_in_context)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 509, in run_in_context
    self.renderer.render(self, self.layout)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/renderer.py", line 581, in render
    self.style.invalidation_hash() != self._last_style_hash
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/style.py", line 398, in invalidation_hash
    return tuple(s.invalidation_hash() for s in self.styles)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/style.py", line 398, in <genexpr>
    return tuple(s.invalidation_hash() for s in self.styles)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/base.py", line 177, in invalidation_hash
    return (self.get_style() or self._dummy).invalidation_hash()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/base.py", line 177, in invalidation_hash
    return (self.get_style() or self._dummy).invalidation_hash()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/base.py", line 177, in invalidation_hash
    return (self.get_style() or self._dummy).invalidation_hash()
  File "/usr/lib/python3.8/site-packages/powerline/renderers/ipython/since_5.py", line 79, in invalidation_hash
    return super(PowerlinePromptStyle, self).invalidation_hash() + 1
TypeError: can only concatenate tuple (not "int") to tuple

If you suspect this is an IPython 7.14.0 bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at [email protected]

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True


 19:05:15  ✘  ~ 
$ pacman -Qi powerline                                                                               otakutyrant  PC
Name            : powerline
Version         : 2.8-1
Description     : Statusline plugin for vim, and provides statuslines and prompts for several other applications,
                  including zsh, bash, tmux, IPython, Awesome, i3 and Qtile
Architecture    : x86_64
URL             : https://github.com/powerline/powerline
Licenses        : MIT
Groups          : None
Provides        : None
Depends On      : python-powerline
Optional Deps   : None
Required By     : None
Optional For    : None
Conflicts With  : powerline2  python-powerline<=2.3-1
Replaces        : python-powerline<=2.3-1
Installed Size  : 28.39 KiB
Packager        : Jiachen YANG <[email protected]>
Build Date      : Mon 18 May 2020 01:55:40 PM CST
Install Date    : Tue 19 May 2020 06:55:56 PM CST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature


 19:09:25  ~ 
$                                                                                                    otakutyrant  PC

/usr/lib/python3.8/site-packages/powerline/renderers/ipython/since_7.pyはすでに存在します。

追加する必要があります

from powerline.bindings.ipython.since_7 import PowerlinePrompts
c.TerminalInteractiveShell.prompts_class = PowerlinePrompts

設定する。 https://github.com/powerline/powerline/blob/develop/docs/source/usage/other.rst
ドキュメントは更新されません。

私はそれを設定に追加しました、そしてそれは今動作します。 ありがとうございました!

新しいリリースをありがとう。 しかし、電力線を2.8-1にアップグレードした後も、このバグが発生しました。 何故かはわからない。



 19:05:12  ~ 
$ ipython                                                                                            otakutyrant  PC
Python 3.8.2 (default, Apr  8 2020, 14:31:25)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.14.0 -- An enhanced Interactive Python. Type '?' for help.

Traceback (most recent call last):
  File "/usr/bin/ipython", line 5, in <module>
    start_ipython()
  File "/usr/lib/python3.8/site-packages/IPython/__init__.py", line 126, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/lib/python3.8/site-packages/traitlets/config/application.py", line 664, in launch_instance
    app.start()
  File "/usr/lib/python3.8/site-packages/IPython/terminal/ipapp.py", line 356, in start
    self.shell.mainloop()
  File "/usr/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 559, in mainloop
    self.interact()
  File "/usr/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 542, in interact
    code = self.prompt_for_code()
  File "/usr/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 468, in prompt_for_code
    text = self.pt_app.prompt(
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py", line 994, in prompt
    return self.app.run(set_exception_handler=set_exception_handler)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 811, in run
    return loop.run_until_complete(
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 778, in run_async
    return await _run_async2()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 760, in _run_async2
    result = await _run_async()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 686, in _run_async
    self._redraw()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 523, in _redraw
    self.context.run(run_in_context)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 509, in run_in_context
    self.renderer.render(self, self.layout)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/renderer.py", line 581, in render
    self.style.invalidation_hash() != self._last_style_hash
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/style.py", line 398, in invalidation_hash
    return tuple(s.invalidation_hash() for s in self.styles)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/style.py", line 398, in <genexpr>
    return tuple(s.invalidation_hash() for s in self.styles)
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/base.py", line 177, in invalidation_hash
    return (self.get_style() or self._dummy).invalidation_hash()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/base.py", line 177, in invalidation_hash
    return (self.get_style() or self._dummy).invalidation_hash()
  File "/usr/lib/python3.8/site-packages/prompt_toolkit/styles/base.py", line 177, in invalidation_hash
    return (self.get_style() or self._dummy).invalidation_hash()
  File "/usr/lib/python3.8/site-packages/powerline/renderers/ipython/since_5.py", line 79, in invalidation_hash
    return super(PowerlinePromptStyle, self).invalidation_hash() + 1
TypeError: can only concatenate tuple (not "int") to tuple

If you suspect this is an IPython 7.14.0 bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at [email protected]

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True


 19:05:15  ✘  ~ 
$ pacman -Qi powerline                                                                               otakutyrant  PC
Name            : powerline
Version         : 2.8-1
Description     : Statusline plugin for vim, and provides statuslines and prompts for several other applications,
                  including zsh, bash, tmux, IPython, Awesome, i3 and Qtile
Architecture    : x86_64
URL             : https://github.com/powerline/powerline
Licenses        : MIT
Groups          : None
Provides        : None
Depends On      : python-powerline
Optional Deps   : None
Required By     : None
Optional For    : None
Conflicts With  : powerline2  python-powerline<=2.3-1
Replaces        : python-powerline<=2.3-1
Installed Size  : 28.39 KiB
Packager        : Jiachen YANG <[email protected]>
Build Date      : Mon 18 May 2020 01:55:40 PM CST
Install Date    : Tue 19 May 2020 06:55:56 PM CST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature


 19:09:25  ~ 
$                                                                                                    otakutyrant  PC

/usr/lib/python3.8/site-packages/powerline/renderers/ipython/since_7.pyはすでに存在します。

追加する必要があります

from powerline.bindings.ipython.since_7 import PowerlinePrompts
c.TerminalInteractiveShell.prompts_class = PowerlinePrompts

設定する。 https://github.com/powerline/powerline/blob/develop/docs/source/usage/other.rst
ドキュメントは更新されません。

実際、ドキュメントはかなり古いものです(最後のビルドは約1。5年前のものです)。 ただし、自動ビルドがどういうわけか機能せず、構成に関する何かをチェック/変更する権限がありません。申し訳ありません。

@ PH111P新しいリリースもPyPIにプッシュしてください。 まだバージョン2.7しかありません...

残念ながら、私にはそうするためのアクセス権があるとは思いません。
それまでの間、 pip install git+https://github.com/powerline/powerline.git@developお試しください。

このページは役に立ちましたか?
0 / 5 - 0 評価

関連する問題

adamk33n3r picture adamk33n3r  ·  4コメント

s-ol picture s-ol  ·  5コメント

guyzmo picture guyzmo  ·  5コメント

damienstanton picture damienstanton  ·  5コメント

uD4ra picture uD4ra  ·  5コメント