[IPython-dev] How can I enable file path autocompletion in the IPython console in PyCharm?

Propadovic Nenad npropadovic at gmail.com
Tue Aug 22 08:36:55 EDT 2017


(I hope that sending variations of the same question to StacKOverflow,
Reddit and here is not considered spamming...)

Path autocompletion in the IPython console in PyCharm does not work well:

c:/U<TAB>

should autocomplete to:

cd c:/Users/

on my machine; instead, the best it manages is:

cd c:/UserWarning

which is plain wrong. IPython in the Anaconda prompt, however, behaves as
it should.

My strong assumption is that this is due to PyCharm not using the standard
IPython configuration files.

I'm aware of the console starting script ins PyCharm:

Settings->Build, Execution, Deployment->Console->Python console

and I've successfully used it to activate a simple magic command I've
written.

So here my question: is there a code configuration snippet that could be
inserted there, and that could just enable file path autocompletion? Or a
pointer to a general description on how IPython configuration files "work",
that would enable me to figure it out myself? That is, I imagine, the most
doable hack that would solve the problem for the time being.

Alternatively, any experiences with writing your own autocompletion using
the following libraries:

IPython.core.completer
IPython.core.completerlib

?

Is that doable? How much work can that be?

Thanks in advance!

Nenad

-----------------------------

Links supporting claims in the question(s) above:

1) Autocompletion in IPython console in PyCharm not working as it should

On StackOverflow there are three questions with similar wording, but not
one substantial answer:

https://stackoverflow.com/questions/32542289/pycharm-ipython-tab-completion-not-working-within-python-console
https://stackoverflow.com/questions/35612338/how-to-set-ipython-profile-in-pycharm
https://stackoverflow.com/questions/32458158/pycharm-python-console-autocompletion

(No, using Ctrl+Space instead of Tab does not solve anything.)

JetBrains (creators of PyCharm) know about this since, at least, two years:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/205820389-Console-tab-completion-

and seems to have started working on it, but never finished it. Discussion
states " this is only the initial step to getting full IPython tab
completions": https://youtrack.jetbrains.com/issue/PY-9345 . But the issue
is closed since October 2016:
https://github.com/JetBrains/intellij-community/pull/440

2) PyCharm not using ipython_config.py to configure IPython Console:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206603035-Which-ipython-config-py-is-used-to-configure-IPython-for-Python-Console-

-----------------------------

My setup: PyCharm Community Edition 2017.2.1 Anaconda 2 (Python 2.7),
version 4.3.22 which contains IPython 5.1.0 on Windows 7 Professional N
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20170822/8580d13e/attachment.html>


More information about the IPython-dev mailing list