Le plugin Powerline pour IPython le fait planter au démarrage pour les versions 7.0.0 et 7.0.1; cela fonctionne bien pour IPython version 6.5.0. Je vais joindre le rapport de plantage détaillé en commentaire. Voici ma configuration 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'
$ 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
Se bloque également avec les configurations par défaut de la documentation:
from powerline.bindings.ipython.since_5 import PowerlinePrompts
c = get_config()
c.TerminalInteractiveShell.simple_prompt = False
c.TerminalInteractiveShell.prompts_class = PowerlinePrompts
Exception:
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
Alors
ipython>=7.0.0
utilise prompt_toolkit>=2.0.0,<2.1.0
ipython<7.0.0
utilise prompt_toolkit>=1.0.15,<2.0.0
Dans prompt_toolkit <2.0.0 invalidation_hash
renvoie toujours str
ou int
, mais dans les derniĂšres versions, il peut Ă©galement renvoyer tuple
.
Pour contourner le problĂšme, j'utilise ceci:
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):
Cependant, je ne suis pas sĂ»r que cela vaille la peine de crĂ©er un PR avec cela. Ăa n'a pas l'air soignĂ©.
Cela vaudrait-il la peine de créer un fichier de type since_7.py
avec un correctif approprié?
Cela pourrait-il ĂȘtre fait? Cela m'empĂȘche d'utiliser Powerline.
Le correctif mentionnĂ© ci-dessus fait que Powerline ne plante pas, mais ne le rĂ©sout pas. Comme dans, l'invite affichĂ©e est laide, avec "&" affichĂ© partout oĂč la couleur est censĂ©e changer.
Les caractĂšres &
semblent ĂȘtre des espaces insĂ©cables ( \xa0
); les désactiver via la configuration du thÚme les remplace par des espaces normaux. Cependant, les couleurs ne semblent toujours pas changer et tout a un fond transparent et #00005f
comme couleur de premier plan.
Je peux confirmer que Powerline est cassé pour les versions actuelles d'iPython (7.4 dans mon cas).
Le correctif suggéré par @Zebradil rend iPython au moins réutilisable (merci!) Mais -
comme déjà mentionné - décore l'invite avec & au lieu de couleurs.
Je rencontre ce problĂšme dans mon IPython 7.3.0. Vous devez arrĂȘter l'extension pour utiliser IPython.
Quand le réparez-vous ~~~
N'hĂ©sitez pas Ă continuer. Commencez avec le patch de @Zebradil et jetez un Ćil
pourquoi l'invite iPython est réduite à un certain nombre de & s.
Vous aideriez beaucoup de personnes affectées par ce bogue.
Que signifie "décore l'invite avec & au lieu de couleurs". ressembler? J'utilise le patch et il ressemble à ci-dessous:
Il n'y en a pas &.
Merci d'avoir approfondi ce problĂšme!
Il n'y en a pas &.
Dans votre cas, le "&" a été remplacé par "_" - intéressant,
semble dépendre du systÚme que vous utilisez.
Voici Ă quoi ressemble l'invite sous Kubuntu 18.04:
Les caractĂšres
&
semblent ĂȘtre des espaces insĂ©cables (\xa0
); les désactiver via la configuration du thÚme les remplace par des espaces normaux. Cependant, les couleurs ne semblent toujours pas changer et tout a un fond transparent et#00005f
comme couleur de premier plan.
Je pense toujours que le problĂšme concernant les &
est un autre problÚme, qui n'est pas lié aux couleurs.
Dans votre cas, le "&" a été remplacé par "_" - intéressant,
semble dépendre du systÚme que vous utilisez.
Cela ne dépend pas du systÚme mais de la version de
prompt-toolkit: je suis passé de 2.0.7 à 2.0.9
et tous les "&" sont "_" maintenant.
C'est / était une nouvelle fonctionnalité de la 2.0.8:
@acgtyrant avez-vous 2.0.9 installé?
Pour les couleurs, il semble que quoi que ce soit aprĂšs le Token.Generic.Prompt
soit ignoré: https://github.com/powerline/powerline/blob/5d82d544f3366a214732aeb8f781d50ced38ceef/powerline/renderers/ipython/since_5.py#L121
Autant que je sache, pour chaque groupe de surbrillance, un nouveau type de jeton est créé et le DynamicStyle
défini dans renderers / ipython / since_5.py est censé créer le style correspondant. Cependant, il semble que ni get_attrs_for_token
ni get_token_to_attributes_dict
soient appelés; en regardant https://github.com/prompt-toolkit/python-prompt-toolkit/commit/c32f3783a76e6b72d53acda0b6c4a15ef13bed3b révÚle que prompt_toolkit n'utilise plus get_attrs_for_token
, mais utilise get_attrs_for_style_str
place.
Il semble que j'ai une solution (trÚs hacky) au problÚme de couleur: enregistrez tous les faits saillants utilisés dans hl
, convertissez-les en paires de formats de style prompt_toolkit et ajoutez ces nouvelles paires aux rÚgles de style déjà générées par l'implémentation
<strong i="7">@property</strong>
def style_rules(self):
dans le class PowerlinePromptStyle(DynamicStyle):
.
Comme vous pouvez le voir, j'ai encore besoin de nettoyer le code, mais cela semble fonctionner.
@ PH111P - Excellent travail, merci d'avoir plongé dans le
Ainsi, les deux nouveaux problÚmes (les couleurs manquantes et les "&" / "_") sont causés par le
mise Ă niveau de prompt-toolkit vers la version 2?
Ainsi, les deux nouveaux problÚmes (les couleurs manquantes et les "&" / "_") sont causés par le
mise Ă niveau de prompt-toolkit vers la version 2?
Je pense que oui, oui.
Peut-ĂȘtre que le guide "Mise Ă jour vers prompt_toolkit 2.0" peut vous aider
puisqu'il explique les changements nécessaires:
https://python-prompt-toolkit.readthedocs.io/en/master/pages/upgrading.html#pygments -styles-and-token
Une implĂ©mentation du correctif de couleur peut ĂȘtre trouvĂ©e ici https://github.com/PH111P/powerline/blob/develop/powerline/renderers/ipython/since_7.py
Le problĂšme avec les nbsp peut ĂȘtre rĂ©solu en les dĂ©sactivant dans les fichiers de configuration (en dĂ©finissant "use_non_breaking_spaces": false
).
Si j'ai un peu de temps, je pourrais Ă©crire une pull request.
@GHPS J'ai installé 2.0.8-1.
Une implĂ©mentation du correctif de couleur peut ĂȘtre trouvĂ©e ici
Génial - vous l'avez corrigé. iPython et Powerline sont à nouveau utilisables!
Merci d'avoir pris le temps et de régler le problÚme ...
Voyez-vous une chance de ressusciter l'indicateur de mode VI
ainsi que? Il manque actuellement ...
J'ajoute le correctif de couleur et la config, mais il y a encore _
dans mon IPython, je ne sais pas pourquoi.
J'ajoute le correctif de couleur et la config, mais il y a encore
_
dans mon IPython, je ne sais pas pourquoi.
Ah dĂ©solĂ©, en effet on ne peut pas vraiment utiliser le fichier de configuration pour cela (le drapeau mentionnĂ© ne fonctionne qu'au niveau du thĂšme global; personnellement, j'ai dĂ©sactivĂ© globalement les nbsp dans la source mais cela ne devrait pas ĂȘtre la voie Ă suivre); il semble que pour corriger les nbsp, le moteur de rendu ipython doit ĂȘtre changĂ©, en particulier l'ajout de quelque chose comme ce qui suit Ă class IPythonPygmentsRenderer(IPythonRenderer):
devrait résoudre ce problÚme
(cette fois, j'ai testé cette solution de contournement, encore une fois désolé que l'autre chose n'ait pas vraiment fonctionné; voir aussi 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(' ')] = ' '
Voyez-vous une chance de ressusciter l'indicateur de mode VI
ainsi que? Il manque actuellement ...
Il semble qu'il n'y ait tout simplement aucun segment avec cette fonctionnalité. Cependant, quelque chose le long de ce qui suit semble fonctionner, n'hésitez pas à le convertir en un segment à part entiÚre (la plupart du code est volé sans vergogne dans l'implémentation ipython réelle: 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
EDIT : Bien qu'il semble montrer le mode actuel, il ne semble pas vraiment se mettre Ă jour: /. Je dois admettre que je n'utilise pas vraiment le mode vi dans ipython, donc je ne peux pas vraiment tester cela.
EDIT 2 : Correction en mettant Ă jour la liaison: https://github.com/PH111P/powerline/blob/448e73b41d61ab6617e86c1f7cfee3db19138700/powerline/bindings/ipython/since_7.py#L69
@ PH111P - GĂ©nial! Bon travail!
Tout en reconnaissant l'excellent travail de Philip (alias @ PH111P ), j'aimerais poser une question si quelque chose pourrait ĂȘtre fait pour l'option --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] â¶
Le PR semble ĂȘtre restĂ© sans surveillance pendant un certain temps. Est-il prĂ©vu de mettre Ă jour cela?
Autant que je sache, tout (sauf --simple-prompt
) semble fonctionner, donc je ne suis pas tout Ă fait sĂ»r de ce Ă quoi vous faites rĂ©fĂ©rence, @teracamo. (En effet, le PR n'a pas encore fusionnĂ©, mais cela semble ĂȘtre liĂ© Ă # 2012; Ă©galement Ă proprement parler le PR manque encore de tests, mais comme je l'ai dit, il devrait dĂ©jĂ ĂȘtre utilisable)
Oh, je fais simplement référence à s'il y a un plan pour que ce PR soit fusionné, car la version actuelle ne fonctionne pas sur ipython> = 7.0.
Je n'ai pas encore essayĂ© le PR moi-mĂȘme, donc je ne peux rien dire sur l'option --simple-prompt
mais je le ferai s'il n'y a pas de plan de fusion.
@alabamagan comment va https://github.com/powerline/powerline/pull/2048 ?
Jusqu'à ce que les modifications soient publiées, consultez la branche develop
pour les obtenir. Cela peut ĂȘtre moins stable que master
, mais il vaut mieux ne pas pouvoir utiliser les invites Powerline du tout:
pip install --user 'git+https://github.com/powerline/powerline.git@develop#powerline'
Ensuite, dans votre configuration ipython, changez since_5
en since_7
, comme ceci:
from powerline.bindings.ipython.since_7 import PowerlinePrompts
c.TerminalInteractiveShell.simple_prompt = False
c.TerminalInteractiveShell.prompts_class = PowerlinePrompts
Combien de temps avant leur libération?
Peut-ĂȘtre qu'une nouvelle version est nĂ©cessaire.
La derniĂšre version date d'il y a 2 ans.
Merci pour une nouvelle version. Mais j'ai quand mĂȘme rencontrĂ© ce bogue aprĂšs avoir mis Ă niveau Powerline vers 2.8-1. Je ne sais pas pourquoi.
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
existe déjà .
Merci pour une nouvelle version. Mais j'ai quand mĂȘme rencontrĂ© ce bogue aprĂšs avoir mis Ă niveau Powerline vers 2.8-1. Je ne sais pas pourquoi.
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
existe déjà .
Tu devrais ajouter
from powerline.bindings.ipython.since_7 import PowerlinePrompts
c.TerminalInteractiveShell.prompts_class = PowerlinePrompts
Ă config. https://github.com/powerline/powerline/blob/develop/docs/source/usage/other.rst
Le document n'est pas mis Ă jour.
Je l'ai ajouté dans la configuration et cela fonctionne maintenant. Je vous remercie!
Merci pour une nouvelle version. Mais j'ai quand mĂȘme rencontrĂ© ce bogue aprĂšs avoir mis Ă niveau Powerline vers 2.8-1. Je ne sais pas pourquoi.
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
existe déjà .Tu devrais ajouter
from powerline.bindings.ipython.since_7 import PowerlinePrompts c.TerminalInteractiveShell.prompts_class = PowerlinePrompts
Ă config. https://github.com/powerline/powerline/blob/develop/docs/source/usage/other.rst
Le document n'est pas mis Ă jour.
En effet, les documents sont assez anciens (la derniÚre version date d'il y a environ 1,5 ans). Cependant, les builds automatiques ne fonctionnent pas et je n'ai pas les autorisations pour vérifier / modifier quoi que ce soit sur les configurations, désolé.
@ PH111P Veuillez Ă©galement
Malheureusement, je ne pense pas avoir le droit d'accĂšs de le faire.
En attendant, vous pouvez essayer pip install git+https://github.com/powerline/powerline.git@develop
.
Commentaire le plus utile
Jusqu'à ce que les modifications soient publiées, consultez la branche
develop
pour les obtenir. Cela peut ĂȘtre moins stable quemaster
, mais il vaut mieux ne pas pouvoir utiliser les invites Powerline du tout:Ensuite, dans votre configuration ipython, changez
since_5
ensince_7
, comme ceci: