pinard/Pymacs

make install doesn't work for Python 3.4.1

Opened this issue · 5 comments

# make install
python pppp -C ppppconfig.py Pymacs.py.in pppp.rst.in pymacs.el.in pymacs.rst.in contrib tests
Traceback (most recent call last):
  File "pppp", line 425, in <module>
    main(*sys.argv[1:])
  File "pppp", line 83, in main
    exec(compile(open(value).read(), value, 'exec'), self.context)
  File "ppppconfig.py", line 17, in <module>
    VERSION = get_version()
  File "ppppconfig.py", line 11, in get_version
    for line in open('setup.cfg'):
  File "/home/aalvesne/coding/python/virtualenv/tmp-5defa29666f51f4/lib/python3.4/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 53: ordinal not in range(128)
Makefile:26: recipe for target 'prepare' failed
make: *** [prepare] Error 1

Nothing to do with Python 3 itself, it had to do with setting the LANG environment variable, which I learned from here.

I had a similar problem on my Windows (Python3):

e:\Project\Python\github\Pymacs>make install
python pppp -C ppppconfig.py Pymacs.py.in pppp.rst.in pymacs.el.in pymacs.rst.in contrib tests
Traceback (most recent call last):
File "pppp", line 425, in
main(sys.argv[1:])
File "pppp", line 127, in main
self.transform_all_files(argument)
File "pppp", line 244, in transform_all_files
input, open(input), open(output, 'w').write)
File "pppp", line 330, in transform_file
self.each_substituded_line(lines)):
File "pppp", line 412, in each_substituded_line
for line in lines:
UnicodeDecodeError: 'gbk' codec can't decode byte 0x94 in position 119: illegal multibyte sequence
Makefile:26: recipe for target 'prepare' failed
make: *
* [prepare] Error 1

I solved this by adding encoding='utf8' to every open() in pppp

Thank you @fd3kyt

by the way
open(value, encoding='utf8')
open(output, 'w', encoding='utf8')

On a current Arch Linux system installed today (September 7th 2015), the LANG environment variable no longer works. The only thing that did was editing pppp to add the encoding kwarg as indicated by @fd3kyt

@fd3kyt

All the tests pass?