Ugly ipython prompt on emacs 23 - emacs

I have a PuTTY terminal running emacs 23. I just installed python-mode.el-6.1.2 and pinard-Pymacs-5989046. The IPython shell looks like this:
IPython 1.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
^[[0;32mIn [^[[1;32m2^[[0;32m]: ^[[0m
Whereas when I run ipython from bash, I get
IPython 1.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]:
Does this look like a charset issue in my PuTTY setup or should I try to find the issue within emacs/python-mode?

Looks like a broken ansi-color-filter
Please check if it happens also with current trunk from
https://launchpad.net/python-mode
Please follow up at:
https://bugs.launchpad.net/python-mode/+bug/1238481

Solution: add this line to ~/.emacs.d/init.el:
(ansi-color-for-comint-mode-on)

Related

How can I enable file path autocompletion in the IPython console in PyCharm?

Note: The suboptimal autocompletion (not necessarily of file paths only, but autocompletion in general) is a known issue, and there seems to be no generic quality solution yet. Please see the researched links below.
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 (supported by a link, below) is that this is due to PyCharm not using the standard IPython configuration files.
I'm aware of the console starting script in 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!
My SW-Setup:
I use:
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
Links supporting claims in the question(s) above - just two, due to lack of StackOverflow-"reputation" :(
1) Autocompletion in IPython console in PyCharm not working as it should
JetBrains (creators of PyCharm) knows about this since, at least, two years (please Google it under "PyCharm Console tab completion" or similar, I'm allowed to add just a limited number of links here), and seems to have started working on it, but never finished it.
The 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.
On StackOverflow there are three questions with similar wording, but not one substantial answer (no, using Ctrl+Space instead of Tab does not solve anything). Again, I can't add more links here.
_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-
See the comment by JetBrains at the end of the page.

ipython - disable welcome message

Everytime i enter into ipython mode, ipython welcomes me with this message,
WARNING: Attempting to work in a virtualenv. If you encounter
problems, please install IPython inside the virtualenv.
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
Type "copyright", "credits" or "license" for more information.
IPython 1.2.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
Greeting people is all good and well but it takes up most of my shell screen and i am made to do clean to remove them.
How can i disable this welcome message via configuration file?
You can use
ipython --no-banner
or set in configuration file
c.TerminalIPythonApp.display_banner = False
Just use:
ipython console
You'll get it, if that's what you want.
Editing the IPython config file
Edit your config file and add
c.TerminalIPythonApp.display_banner = False
The default profile's config file is found at /home/<user>/.ipython/profile_default/ipython_config.py
The documentation for IPython configuration can be found here
Updating default profile
Create new config file if it does not exist, or use
ipython locate profile
to view the current profile location.

Stop ipython pop-up docs

In the ipython qtconsole it automatically displays the documentation for a function when I type the opening parenthesis. For example, when I'm typing
plt.show()
the documentation for pyplot.show is displayed when I've typed
plt.show(
This documentation is displayed in a pop-up window that, much more often than not, blocks my view what I'm typing. Is there a configuration to stop the ipython qtconsole from doing this?
The feature to which you refer is calltips or more precisely IPythonWidget.enable_calltips and is documented at https://ipython.org/ipython-doc/dev/config/options/qtconsole.html. The only effective way I have found to disable it is by adding --IPythonWidget.enable_calltips=False as an argument to qtconsole that in turn an argument of ipython. A command line for all of this is:
ipython qtconsole --IPythonWidget.enable_calltips=False
I have verified this with IPython QTConsole 3.2.0 and believe it generally works for versions below 4, which I have not been able to install yet without breaking QTConsole. (I believe what some refer to as IPython 4 is also known as Jupyter 4. See below for information on Jupyter and disabling calltips in it.)
On Linux and Windows system, generating this command line can be automated using a bash alias. On Windows it can be automated by using it as the Target of an icon configured in its properties.
It is supposed to be possible to disable calltips by setting c.IPythonWidget.enable_calltips = False in the right configuraton file in which c = get_config() is set on the first line. I tried doing this on a Windows 7 system in ipython_qtconsole_config.py and ipython_config.py in ~.ipython\profile_default\ and several other locations, but could not get it to work.
Project Jupyter is the successor to the IPython project and began in 2014. Its website is http://jupyter.org and information about its Qt console is at http://jupyter.org/qtconsole/stable/index.html. In response to a question about disabling IPython calltips, which I submitted to https://github.com/ipython/ipython/issues, I received the following on how to disable calltips for Jupyter:
On the command line
jupyter qtconsole --JupyterWidget.enable_calltips=False
or add
c.JupyterWidget.enable_calltips = False
to
~/.jupyter/juptyer_qtconsole_config.py

No prompt appears when I fire up the IPython Console

I am new to Linux and Python, just starting some programming this weekend. All was going great until this morning, when I was playing with "save" to save my workspace. (I selected the "magic" menu bar, so perhaps I screwed up something from there.) I must have changed my settings so that the prompt no longer appears when I start IPython. I get all the stuff that normally appears prior to getting the prompt (shown below), but no prompt and the interpreter does not work. If I run IPython in terminal, I get the prompt and all works fine. The problem is just in IPython console. I have rebooted just in case (perhaps this is a windows thing and does not apply to Linux).
Python 2.7.3 (default, Apr 10 2013, 06:20:15)
Type "copyright", "credits" or "license" for more information.
IPython 0.12.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
%guiref -> A brief reference about the graphical user interface.
"ipython console" or "ipython qtconsole" ? Also try upgrading, 0.12.1 is almost 2 years old.
You can try to remove/rename ~/.ipython folder where all IPython config/history is stored.

Canopy working with Enthought

I've been using the Enthought Python Distribution for about a month, and like it a lot. I test my code in ipython, which gives me the following when I launch it in a terminal :
Enthought Python Distribution -- www.enthought.com
Python 2.7.3 |EPD 7.3-2 (64-bit)| (default, Apr 12 2012, 11:14:05)
Type "copyright", "credits" or "license" for more information.
IPython 0.12.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
I'm now looking for an IDE, and I've come across problems with Canopy - specifically, getting it to use my Enthought distribution as their live consoles, much like my ipython works.
I can't find anywhere to change the interpreter under Canopy. When it launches, it gives me
Welcome to Canopy's interactive data-analysis environment!
with pylab-backend set to: None
Type '?' for more information.
This isn't using EPD, and thus, isn't using any of the packages that I've got installed.
Any ideas would be fantastic !
Thanks.
This article should answer your question.
In brief, there is no way at present to change the interpreter in Canopy. However, Canopy is built on an improved version of EPD.
So you would need to re-install your packages into Canopy. However you should never need to do this again, even when Python is updated (e.g. eventually to 2.7.5) -- whereas with EPD, whenever the interpreter changed, you had to reinstall and start from scratch.
If you do install Canopy 1.0.0, be sure to update to 1.0.1 (from Help menu) before installing your other packages.