question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Console does not type right parenthesis immediately when there are big objects present in its namespace

See original GitHub issue

Description

What steps will reproduce the problem?

Typing ( in the integrated iPython console often prevents calling functions for about a minute. For example, if I type print('Hello world!') in the console, the following usually happens:

  • The console initially doesn’t display the (, e.g. it displays print'Hello world!').
  • On pressing the ( key, the help window does not change to display the docstring of the current function (as it should do).
  • If I press enter, the function is not executed and I get the ... continuation prompt.
  • I can still run scripts from the editor pane with F5 etc. and can continue to use the editor as normal.
  • I cannot execute anything from the console (directly), even if I delete the typed command.
  • After a while (anything from 10 seconds to over a minute), the ( character is displayed at the end of the console prompt, e.g. it becomes print'Hello world')( and the help window updates to display the documentation for the print command. It is now possible to type and execute new commands in the console, although pressing enter immediately obviously gives a syntax error:
    print'Hello world!')(
                      ^
SyntaxError: invalid syntax

This doesn’t happen all the time, but generally occurs most times ( is typed in the console as part of a function or method call. It will happen for any function/method (even if that function/method doesn’t exist (e.g. blah()). This issue does not occur for typing ( for other purposes (e.g. (1+2)/3 is fine). This issue does not occur for anything which is typed in the editor.

My guess is that this is some issue related to the help window, as the help window contents should be updated when ( is typed as part of a function/method call.

Versions

  • Spyder version: 3.3.1
  • Python version: 3.6.6
  • Qt version: 5.9.6
  • PyQt5 version: 5.9.2
  • Operating System: Darwin 17.7.0

Dependencies

IPython >=4.0     :  7.1.1 (OK)
cython >=0.21     :  0.29 (OK)
jedi >=0.9.0      :  0.13.1 (OK)
matplotlib >=2.0.0:  3.0.1 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
numpy >=1.7       :  1.15.3 (OK)
pandas >=0.13.1   :  0.23.4 (OK)
psutil >=0.3      :  5.4.8 (OK)
pycodestyle >=2.3 :  2.4.0 (OK)
pyflakes >=0.6.0  :  2.0.0 (OK)
pygments >=2.0    :  2.2.0 (OK)
pylint >=0.25     :  2.1.1 (OK)
qtconsole >=4.2.0 :  4.4.2 (OK)
rope >=0.9.4      :  0.11.0 (OK)
sphinx >=0.6.6    :  1.8.1 (OK)
sympy >=0.7.3     :  1.3 (OK)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ccordoba12commented, Nov 13, 2018

it looks like the issue only occurs when Preferences > Help > IPython Console is enabled.

That’s because that’s equivalent to have

Tools > Preferences > IPython Console > Display > Display balloon tips

activated.

The problem usually appears when there are very big objects in your namespace (e.g. big dataframes). Is that the case for you?

0reactions
1313ecommented, Aug 20, 2019

If I can add to this; I get this problem every time I try to use getattr() in the IPython console, regardless of what is currently present in my namespace (I can open a new one, not import anything at all, and it will still have that problem).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is that correct to use 'using namespace' instead of nesting the ...
My point is that 'using' just affects the name lookup so A is looked for in the NS namespace, so my approach is...
Read more >
Documentation - Everyday Types - TypeScript
In this chapter, we'll cover some of the most common types of values you'll find in JavaScript code, and explain the corresponding ways...
Read more >
Welcome to C# 10 - .NET Blog
This simplifies the code and removes a level of nesting. Only one file-scoped namespace declaration is allowed, and it must come before any ......
Read more >
Some Practice Problems for the C++ Exam and Solutions for ...
cout << "Enter a non-negative integer: "; cin >> n;. } 16. In the code fragment below, the programmer has almost certainly made...
Read more >
JavaScript object basics - Learn web development | MDN
Congratulations, you've reached the end of our first JS objects article — you should now have a good idea of how to work...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found