Skip to content

Commit

Permalink
support of encoding for WriteCSV in Python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
maet3608 committed Aug 31, 2020
1 parent 6e513b6 commit c7666e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nutsflow/sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import csv
import math
import io
import six

import collections as cl
Expand Down Expand Up @@ -590,7 +591,7 @@ def __init__(self, filepath, cols=None, skipheader=0, flush=False,
:param kwargs kwargs: Keyword arguments for Python's CSV writer.
See https://docs.python.org/2/library/csv.html
"""
self.csvfile = open(filepath, 'w', encoding=encoding)
self.csvfile = io.open(filepath, 'w', encoding=encoding)
self.columns = cols if cols is None else as_tuple(cols)
self.flush = flush
self.fmtfunc = fmtfunc
Expand Down

0 comments on commit c7666e1

Please sign in to comment.