Python/Pycharm, Ctrl-Space does not bring up code completion
Solution 1
Adding response from JetBrains: @CrazyCoder was right there. The problem is that we are not able to infer proper return type of the function "urllib.request.urlopen()" since its implementation uses some dynamic tricks that we cannot handle statically, in particular:
Normally, we deal with difficult cases like that using external annotations in python-skeletons but it doesn't contain type hints for "urllib.request" module yet. Also in the upcoming versions of PyCharm we're planning to switch to the collection of annotations gathered in typeshed project. It evolves much more actively and already contains some annotations for "urllib". To benefit from them you just need to drop "urllib" package with annotations somewhere in your interpreter paths, so that PyCharm could find the respective .pyi stubs.
Solution 2
Have you looked at the Pycharm page for Editor code completion settings?
http://www.jetbrains.com/pycharm/webhelp/editor-code-completion.html
By Enabling Smart Type code completion?
Solution 3
Check whether the IDE is in Power Saving Mode. If it is, then no code completion process or any any other background process works
It shows about it in the status bar at the bottom of the IDE
Related videos on Youtube
![Hartmut Pfarr](https://i.stack.imgur.com/myngf.jpg?s=256&g=1)
Hartmut Pfarr
Updated on June 17, 2022Comments
-
Hartmut Pfarr about 2 years
I have the following file. Why does code completion not run when I press
Ctrl-Space
after the "r."? It says "no suggestion" in a red box.(The program as it is runs and puts out: 200)
__author__ = 'hape' import urllib.request import urllib.response print("Starting") r = urllib.request.urlopen("http://www.python.org") r. <------------ No code completion, why not?! print (r.getcode())
After the
r.
, code completion does not popup, why?-
CrazyCoder over 11 years
-
EML over 11 years@CrazyCoder has the answer here. A quick and dirty solution to the issue is to put an
import pdb; pdb.set_trace()
at the line in question, and in the debugger terminal enterdir(r)
to reveal the attributes of ther
object. -
CrazyCoder over 11 yearsPyCharm 2.7 will use runtime information from the debugger for type hints.
-