Ipython: NameError: o nome 'sys' não está definido

Criado em 26 dez. 2020  ·  9Comentários  ·  Fonte: ipython/ipython

Django 3.1.4
Python 3.9.1
IPython 7.19.0
O erro ocorre durante a importação:

`` `Traceback (última chamada mais recente):
Arquivo "/usr/local/lib/python3.9/site-packages/IPython/terminal/ptutils.py", linha 113, em get_completions
rendimento de self._get_completions (corpo, deslocamento, cursor_position, self.ipy_completer)
Arquivo "/usr/local/lib/python3.9/site-packages/IPython/terminal/ptutils.py", linha 129, em _get_completions
para c nas conclusões:
Arquivo "/usr/local/lib/python3.9/site-packages/IPython/core/completer.py", linha 438, em _deduplicate_completions
conclusões = lista (conclusões)
Arquivo "/usr/local/lib/python3.9/site-packages/IPython/core/completer.py", linha 1818, nas conclusões
para c em self._completions (texto, deslocamento, _timeout = self.jedi_compute_type_timeout / 1000):
Arquivo "/usr/local/lib/python3.9/site-packages/IPython/core/completer.py", linha 1861, em _completions
matched_text, matchs, match_origin, jedi_matches = self._complete (
Arquivo "/usr/local/lib/python3.9/site-packages/IPython/core/completer.py", linha 2029, em _complete
completions = self._jedi_matches (
Arquivo "/usr/local/lib/python3.9/site-packages/IPython/core/completer.py", linha 1373, em _jedi_matches
interpreter = jedi.Interpreter (
Arquivo "/usr/local/lib/python3.9/site-packages/jedi/api/__init__.py", linha 725, em __init__
super () .__ init __ (código, ambiente = ambiente,
TypeError: __init __ () obteve um argumento de palavra-chave inesperado 'coluna'

Durante o tratamento da exceção acima, outra exceção ocorreu:

Traceback (última chamada mais recente):
Arquivo "/src/manage.py", linha 15, em
execute_from_command_line (sys.argv)
Arquivo "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", linha 401, em execute_from_command_line
utility.execute ()
Arquivo "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", linha 395, em execução
self.fetch_command (subcomando) .run_from_argv (self.argv)
Arquivo "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", linha 330, em run_from_argv
self.execute ( args, * cmd_options)
Arquivo "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", linha 371, em execução
output = self.handle ( args, * options)
Arquivo "/usr/local/lib/python3.9/site-packages/django/core/management/commands/shell.py", linha 100, no identificador
return getattr (self, shell) (opções)
Arquivo "/usr/local/lib/python3.9/site-packages/django/core/management/commands/shell.py", linha 36, ​​em ipython
start_ipython (argv = [])
Arquivo "/usr/local/lib/python3.9/site-packages/IPython/__init__.py", linha 126, em start_ipython
retornar launch_new_instance (argv = argv, * kwargs)Arquivo "/usr/local/lib/python3.9/site-packages/traitlets/config/application.py", linha 845, em launch_instanceapp.start ()Arquivo "/usr/local/lib/python3.9/site-packages/IPython/terminal/ipapp.py", linha 356, no inícioself.shell.mainloop ()Arquivo "/usr/local/lib/python3.9/site-packages/IPython/terminal/interactiveshell.py", linha 564, no mainloopself.interact ()Arquivo "/usr/local/lib/python3.9/site-packages/IPython/terminal/interactiveshell.py", linha 547, em interaçãocode = self.prompt_for_code ()Arquivo "/usr/local/lib/python3.9/site-packages/IPython/terminal/interactiveshell.py", linha 473, em prompt_for_codetext = self.pt_app.prompt (Arquivo "/usr/local/lib/python3.9/site-packages/prompt_toolkit/shortcuts/prompt.py", linha 1013, no promptreturn self.app.run (set_exception_handler = set_exception_handler)Arquivo "/usr/local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", linha 816, em execuçãoreturn loop.run_until_complete (Arquivo "/usr/local/lib/python3.9/asyncio/base_events.py", linha 642, em run_until_completeretornar future.result ()Arquivo "/usr/local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", linha 783, em run_asyncretornar esperar _run_async2 ()Arquivo "/usr/local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", linha 771, em _run_async2esperar self.cancel_and_wait_for_background_tasks ()Arquivo "/usr/local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", linha 872, em cancel_and_wait_for_background_tasksaguardar tarefaArquivo "/usr/local/lib/python3.9/site-packages/prompt_toolkit/buffer.py", linha 1854, em new_coroutineaguardar co-rotina ( a, ** kw)
Arquivo "/usr/local/lib/python3.9/site-packages/prompt_toolkit/buffer.py", linha 1683, em async_completer
async para conclusão em self.completer.get_completions_async (
Arquivo "/usr/local/lib/python3.9/site-packages/prompt_toolkit/completion/base.py", linha 269, em get_completions_async
async para conclusão em completer.get_completions_async (
Arquivo "/usr/local/lib/python3.9/site-packages/prompt_toolkit/completion/base.py", linha 196, em get_completions_async
para o item em self.get_completions (document, complete_event):
Arquivo "/usr/local/lib/python3.9/site-packages/IPython/terminal/ptutils.py", linha 116, em get_completions
exc_type, exc_value, exc_tb = sys.exc_info ()
NameError: o nome 'sys' não está definido

But when I just call `import sys` this it works:

Python 3.9.1 (padrão, 25 de dezembro de 2020, 21:17:19)
[GCC 9.3.0] no Linux
Digite "ajuda", "direitos autorais", "créditos" ou "licença" para obter mais informações.

import sys
sys.exc_info ()
(Nenhum, Nenhum, Nenhum)
`` `

Comentários muito úteis

Como solução temporária para qualquer pessoa que esteja apenas tentando fazer as coisas funcionarem novamente:

pip install jedi==0.17.2

No entanto, esta ainda é uma duplicata de # 12740. Por favor, feche.

Todos 9 comentários

Mesmo problema, mesmas versões.

O mesmo problema ocorre em qualquer tipo de preenchimento por meio da tecla tab

O mesmo problema no OS X com Python 3.7.9.

Eu digito import s<TAB> e o pop-up de preenchimento da guia não aparece. Se eu pressionar Enter duas vezes, o console trava.

Crash_report_ipython.txt

... e é jedi

> conda list --revisions
[...]
2020-12-25 18:48:21  (rev 81)
     jedi  {0.17.2 (conda-forge/win-64) -> 0.18.0 (conda-forge/win-64)}
     psycopg2  {2.8.6 (conda-forge/win-64) -> 2.8.6 (conda-forge/win-64)}
     pytz  {2020.4 (conda-forge/noarch) -> 2020.5 (conda-forge/noarch)}
     tqdm  {4.54.1 (conda-forge/noarch) -> 4.55.0 (conda-forge/noarch)}

Reverter para 17.2 resolve o problema ...

O mesmo problema. MacOSX big sur.

Como solução temporária para qualquer pessoa que esteja apenas tentando fazer as coisas funcionarem novamente:

pip install jedi==0.17.2

No entanto, esta ainda é uma duplicata de # 12740. Por favor, feche.

Tenho o mesmo problema com Python 3.7.7 e ipython 7.19.0 no CentOs 7

Esta página foi útil?
0 / 5 - 0 avaliações