This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IPython4 bash magic ! with {} does not work with Python 3.5.1
Type: behavior Stage:
Components: Versions: Python 3.5
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: Christoph Böddeker, SilentGhost, abarry, brett.cannon
Priority: normal Keywords:

Created on 2016-01-09 14:25 by Christoph Böddeker, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (6)
msg257833 - (view) Author: Christoph Böddeker (Christoph Böddeker) Date: 2016-01-09 14:25
Hello, 

I found a wrong behavior with IPython 4 in combination with Python 3.5.1. 

Normally in a command like "In [2]: !echo {a}" everything inside {} is interpreted with python and inserted to executed the line with bash. After I done a upgrade tp Python 3.5.1 this wasn't working. After a downgrade (3.5.0) it was working.

In the bottom is an example, where "In [2]: !echo {a}" are the important lines.
In [2]: !echo {a}
 * Python 3.5.0 -> 3
 * Python 3.5.1 -> {a}

Best regards
Christoph 

-----------------------------------------------------------------------
$ ipython
Python 3.5.1 |Anaconda 2.4.0 (64-bit)| (default, Dec  7 2015, 11:16:01) 
Type "copyright", "credits" or "license" for more information.

IPython 4.0.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]: a = 3

In [2]: !echo {a}
{a}

In [3]: 
-----------------------------------------------------------------------
conda install python=3.5.0
Fetching package metadata: ....
Solving package specifications: ................
Package plan for installation in environment /opt/anaconda3:

The following packages will be DOWNGRADED:

    python: 3.5.1-0 --> 3.5.0-1

Proceed ([y]/n)? y

Unlinking packages ...
[      COMPLETE      ]|###################################################| 100%
Linking packages ...
[      COMPLETE      ]|###################################################| 100%

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

$ ipython
Python 3.5.0 |Anaconda 2.4.0 (64-bit)| (default, Oct 19 2015, 21:57:25) 
Type "copyright", "credits" or "license" for more information.

IPython 4.0.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]: a = 3

In [2]: !echo {a}
3

In [3]:
msg257847 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2016-01-09 17:58
Python itself has nothing to do with IPython's shell commands (i.e., !). It would be best to report this bug to IPython to have them fix it on their end.
msg257851 - (view) Author: Christoph Böddeker (Christoph Böddeker) Date: 2016-01-09 18:36
That's true. Now I have finde the reason.

Someone has changed a function in lib/python3.5/string.py : _vformat.
This function returns now a tuple (befor it was only one return value).

IPython inherits from this object in lib/python3.5/site-packages/IPython/utils/text.py
Because of this change the IPython code is not working.

It seems to me, that this change in python is not nessesary.

I don't, know how to find the commit, message who has changed this and why.



Python 3.5.0:
def _vformat( ..., auto_arg_index=0):
    ...
    format_spec = self._vformat( ..., auto_arg_index=auto_arg_index)
    ...
    return ''.join(result)

Python 3.5.1:
def _vformat( ..., auto_arg_index=0):
    ...
    format_spec, auto_arg_index = self._vformat( ..., auto_arg_index=auto_arg_index)
    ...
    return ''.join(result), auto_arg_index
msg257852 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2016-01-09 18:44
> It seems to me, that this change in python is not nessesary.

> I don't, know how to find the commit, message who has changed this and why.

It was done in issue 13598. It's a bit puzzling that IPython decided to depend on behaviour of a private method. I'd suggest you take it up with them.
msg257853 - (view) Author: Anilyka Barry (abarry) * (Python triager) Date: 2016-01-09 18:54
The choice of IPython to depend on a private, undocumented method means that they are subject to such bugs. A quick Google search tells me you should probably report the issue here: https://github.com/ipython/ipython/issues
msg257854 - (view) Author: Christoph Böddeker (Christoph Böddeker) Date: 2016-01-09 19:03
ok, thanks, I have opend there an issue https://github.com/ipython/ipython/issues/9120
History
Date User Action Args
2022-04-11 14:58:26adminsetgithub: 70250
2016-01-09 19:03:09Christoph Böddekersetmessages: + msg257854
2016-01-09 18:54:49abarrysetstatus: open -> closed
nosy: + abarry
messages: + msg257853

2016-01-09 18:44:48SilentGhostsetnosy: + SilentGhost
messages: + msg257852
2016-01-09 18:36:26Christoph Böddekersetstatus: closed -> open

messages: + msg257851
2016-01-09 17:58:15brett.cannonsetstatus: open -> closed

nosy: + brett.cannon
messages: + msg257847

resolution: third party
2016-01-09 14:25:36Christoph Böddekercreate