Skip to content

Remove redundant 'U' from mode argument to FileType

Stuart Rowan requested to merge fix-for-linux into master

It turns out universal line ending handling is on by default in Python 3 and passing 'U' in to the mode is supposed to have no effect. See https://docs.python.org/3/library/functions.html#open for further information.

Unfortunately, commit fc0be4f4 which introduced the use of argparse.FileType also put 'U' in the mode argument. The effect it is having is causing aoix on Linux to fall over as follows:

aoix: error: argument -o: invalid FileType('wU', encoding='UTF-8') value: 'lala.html'

This commit removes 'U' from the mode argument of FileType so that the code will now run on Linux. The code prior to this commit ran fine on Windows and the code as of this commit also runs fine on Windows.

Merge request reports