When dfm reads the files in the input directory, it assumes all are valid input files. However, if an input file is open in vim when this occurs, dfm will try to read lines from the .swp file (which is a binary file):
$ dotfiles -v
Preparing dotfiles with args: /Users/rick/code/dotfiles/src -v
Environment:
platform: Darwin
input_dir: /Users/rick/code/dotfiles/src
backups_dir: /Users/rick/code/dotfiles/src/backups
output_dir: /Users/rick
args: Namespace(clobber=False, file=None, input_dir='/Users/rick/code/dotfiles/src', no_local=False, output_dir=None, revert=False, verbose=True)
Compiling file: .bash_profile
Reading input file bash
Reading input file bash_mac_gnu
Reading input file bash_local
Backing up /Users/rick/.bash_profile to /Users/rick/code/dotfiles/src/backups/bash_profile_2017-06-09_14-05-56.bak
Writing output file /Users/rick/.bash_profile
File completed.
Compiling file: ..tmux.conf.swp
Reading input file .tmux.conf.swp
Traceback (most recent call last):
File "/Users/rick/code/dotfiles-manager/dotfilesmanager/dfm.py", line 142, in <module>
main()
File "/Users/rick/code/dotfiles-manager/dotfilesmanager/dfm.py", line 138, in main
ioutils.compile_dotfiles(env.INPUT_DIR)
File "/Users/rick/code/dotfiles-manager/dotfilesmanager/ioutils.py", line 67, in compile_dotfiles
compile_dotfile(dotfile)
File "/Users/rick/code/dotfiles-manager/dotfilesmanager/ioutils.py", line 77, in compile_dotfile
write_input_file_contents(input_file_name, file_buffer)
File "/Users/rick/code/dotfiles-manager/dotfilesmanager/ioutils.py", line 92, in write_input_file_contents
for line in input_file:
File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 17: invalid continuation byte
Possible Solutions
Check file content type before reading. If it isn't UTF-8, warn and ignore.
Implement a .dotfilesignore file and place in the source dir.
When dfm reads the files in the input directory, it assumes all are valid input files. However, if an input file is open in vim when this occurs, dfm will try to read lines from the .swp file (which is a binary file):
Possible Solutions
.dotfilesignore
file and place in the source dir.