Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'sys' is not defined #12742

Closed
munrad opened this issue Dec 26, 2020 · 9 comments
Closed

NameError: name 'sys' is not defined #12742

munrad opened this issue Dec 26, 2020 · 9 comments
Milestone

Comments

@munrad
Copy link

munrad commented Dec 26, 2020

Django 3.1.4
Python 3.9.1
IPython 7.19.0
Error occurs during import:

  File "/usr/local/lib/python3.9/site-packages/IPython/terminal/ptutils.py", line 113, in get_completions
    yield from self._get_completions(body, offset, cursor_position, self.ipy_completer)
  File "/usr/local/lib/python3.9/site-packages/IPython/terminal/ptutils.py", line 129, in _get_completions
    for c in completions:
  File "/usr/local/lib/python3.9/site-packages/IPython/core/completer.py", line 438, in _deduplicate_completions
    completions = list(completions)
  File "/usr/local/lib/python3.9/site-packages/IPython/core/completer.py", line 1818, in completions
    for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
  File "/usr/local/lib/python3.9/site-packages/IPython/core/completer.py", line 1861, in _completions
    matched_text, matches, matches_origin, jedi_matches = self._complete(
  File "/usr/local/lib/python3.9/site-packages/IPython/core/completer.py", line 2029, in _complete
    completions = self._jedi_matches(
  File "/usr/local/lib/python3.9/site-packages/IPython/core/completer.py", line 1373, in _jedi_matches
    interpreter = jedi.Interpreter(
  File "/usr/local/lib/python3.9/site-packages/jedi/api/__init__.py", line 725, in __init__
    super().__init__(code, environment=environment,
TypeError: __init__() got an unexpected keyword argument 'column'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/src/manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/shell.py", line 100, in handle
    return getattr(self, shell)(options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/shell.py", line 36, in ipython
    start_ipython(argv=[])
  File "/usr/local/lib/python3.9/site-packages/IPython/__init__.py", line 126, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/traitlets/config/application.py", line 845, in launch_instance
    app.start()
  File "/usr/local/lib/python3.9/site-packages/IPython/terminal/ipapp.py", line 356, in start
    self.shell.mainloop()
  File "/usr/local/lib/python3.9/site-packages/IPython/terminal/interactiveshell.py", line 564, in mainloop
    self.interact()
  File "/usr/local/lib/python3.9/site-packages/IPython/terminal/interactiveshell.py", line 547, in interact
    code = self.prompt_for_code()
  File "/usr/local/lib/python3.9/site-packages/IPython/terminal/interactiveshell.py", line 473, in prompt_for_code
    text = self.pt_app.prompt(
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1013, in prompt
    return self.app.run(set_exception_handler=set_exception_handler)
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 816, in run
    return loop.run_until_complete(
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 783, in run_async
    return await _run_async2()
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 771, in _run_async2
    await self.cancel_and_wait_for_background_tasks()
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 872, in cancel_and_wait_for_background_tasks
    await task
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/buffer.py", line 1854, in new_coroutine
    await coroutine(*a, **kw)
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/buffer.py", line 1683, in async_completer
    async for completion in self.completer.get_completions_async(
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/completion/base.py", line 269, in get_completions_async
    async for completion in completer.get_completions_async(
  File "/usr/local/lib/python3.9/site-packages/prompt_toolkit/completion/base.py", line 196, in get_completions_async
    for item in self.get_completions(document, complete_event):
  File "/usr/local/lib/python3.9/site-packages/IPython/terminal/ptutils.py", line 116, in get_completions
    exc_type, exc_value, exc_tb = sys.exc_info()
NameError: name 'sys' is not defined

But when I just call import sys this it works:

Python 3.9.1 (default, Dec 25 2020, 21:17:19)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.exc_info()
(None, None, None)
@rHermes
Copy link

rHermes commented Dec 26, 2020

Same problem, same versions.

@thorstenkampe
Copy link

Same issue, happens on any kind of completion via tab key

@coreysharris
Copy link

coreysharris commented Dec 26, 2020

Same problem on OS X with Python 3.7.9.

I type import s<TAB> and the tab-completion pop-up doesn't appear. If I press Enter twice, the console crashes.

Crash_report_ipython.txt

@thorstenkampe
Copy link

...and it's 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)}

Reverting to 17.2 solves the issue...

@thorstenkampe
Copy link

Opened davidhalter/jedi#1716 for this issue

@davidhalter
Copy link

This is a duplicate of #12740.

@jkryanchou
Copy link

Same issue. MacOSX big sur.

@davidhalter
Copy link

As a temporary fix for anyone just trying to get things working again:

pip install jedi==0.17.2

However this is still a duplicate of #12740. Please close it.

@munrad munrad closed this as completed Dec 27, 2020
@felixchr
Copy link

Got the same problem with Python 3.7.7 and ipython 7.19.0 on CentOs 7

bluemellophone added a commit to WildMeOrg/wildbook-ia that referenced this issue Jan 11, 2021
@Carreau Carreau added this to the 7.20 milestone Jan 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants