You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the following error if my input file corpus is not utf8 encoded:
Traceback (most recent call last):
File "replace.py", line 50, in <module>
dry_run=False,
File "/home/tyler/repos/massedit/massedit.py", line 440, in edit_files
diffs = list(editor.edit_file(path))
File "/home/tyler/repos/massedit/massedit.py", line 202, in edit_file
new_file.writelines(to_lines)
TypeError: must be unicode, not str
No problem. I think it's not right to assume utf-8 for all input files. I've made changes to allow the user to specify the encoding. I'll polish and commit this week end.
I get the following error if my input file corpus is not
utf8
encoded:A change to https://github.com/elmotec/massedit/blob/master/massedit.py#L202
resolves this:
new_file.writelines(line.decode('utf8') for line in to_lines)
I can provide a PR if necessary.
The text was updated successfully, but these errors were encountered: