[issue24086] Configparser interpolation is unexpected

2015-05-04 Thread Trevor Bekolay

Trevor Bekolay added the comment:

Thanks for the quick response! I can see the use case for using interpolation 
in .pypirc. Unfortunately for me, I push releases for both Python 2 and Python 
3, so having the double percent sign will cause problems for me on Python 2.

The exception that's being raised is at line 442 
(https://hg.python.org/cpython/file/default/Lib/configparser.py#l442). The 
message itself seems to have the right information, but setuptools seems to 
mangle it  (perhaps InterpolationSyntaxError needs a __repr__ or __str__?)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24086
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24086] Configparser interpolation is unexpected

2015-04-30 Thread Trevor Bekolay

New submission from Trevor Bekolay:

I was having an issue installing a package in Python 3, which installed 
properly in Python 2. This is the error message I got:

Complete output from command python setup.py egg_info:
Traceback (most recent call last):

... snip unhelpful traceback ...

  File 
/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/configparser.py,
 line 423, in _interpolate_some

found: %r % (rest,))

configparser.Interpolation


Command python setup.py egg_info failed with error code 1 in 
/private/var/folders/12/p4ngkfbx2pnb1ln81csjb19cgn/T/pip-build-6xhgg5x6/nengo

This wasn't a super helpful error message. I managed to figure out that Python 
3 (or setuptools?) was attempting to parse my ~/.pypirc file, which raised a 
configparser.InterpolationSyntaxError because my password contained a 
percent-sign. Configparser doesn't try to interpolate this string in Python 2, 
so it worked fine. As a workaround, I've changed my PyPI password, but this 
failure was quite surprising to me.

As for what I would expect to happen, I would not expect interpolation to 
happen if I don't want it to happen. All of the examples shown on in the docs 
use the syntax %(key)s or ${key}. If this is the only way to interpolate, 
then why is % ambiguous? Surely we can look forward one character, and if 
it's not ( then % should be interpreted literally. Instead, configparser 
requires me to disambiguate with %%. But, this would cause my string to be 
parsed incorrectly in Python 2's configparser, so I'm unable to make that 
change.

--
components: Library (Lib)
messages: 242283
nosy: tbekolay
priority: normal
severity: normal
status: open
title: Configparser interpolation is unexpected
type: behavior
versions: Python 3.2, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24086
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com