getpelican/pelican — pull request #856 by avaris (2013-04-18 19:06:31+00:00)
Title: force argparse output to be unicode in Py2

In Py2, the result of ``argparse`` is bytes. Since pelican assumes everything is unicode, this causes problems because at some point implicit conversion is unavoidable.

Most obvious way to observe the problem is when the content path has non-ascii chars:

$ ls contént/
test.rst тест.md

$ pelican -s pelican.conf.py contént
CRITICAL: 'ascii' codec can't decode byte 0xc3 in position 41: ordinal not in range(128)

When the path is ascii but there is a file with non-ascii char, the problem occurs with ``-r`` (autoreload) option.

$ ls content/
test.rst тест.md

$ pelican -s pelican.conf.py content

$ rm -rf output

$ pelican -s pelican.conf.py -r content
WARNING: No valid files found in content. Nothing to generate.

This PR solves that by converting the relevant ``argparse`` output to unicode in Py2