NaPs / Confiture

Configure your projects with taste!

Home Page:https://pypi.python.org/pypi/confiture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Illegal line break character in configuration file

stschiggerl opened this issue · comments

When working on windows and unix (e.g. writing configuration file under windows, but parsing it with python installed on cygwin), there is this inconsistence with different line breaks. For the mentioned example, the configuration file contains \r\n line breaks, but unix python does not allow this and we get the ParsingError:

Illegal character u'\r'

To prevent this, an easy solution is available. Just change the first line of from_filename function from

fconf = open(filename)

to

fconf = open(filename, 'Ur')

This allows universal line breaks and can treat any of the unix/mac/windows line break styles like described in: http://docs.python.org/2/library/functions.html#open

Hi, I fixed it. Thanks for the report!