beremiz

Py_Ext: fix python3 encoding not needed in python2
py2compat
16 months ago, Edouard Tisserant
bf3558468e3a
Parents a1c1ac9623fd
Children 9e7283b30376
Py_Ext: fix python3 encoding not needed in python2
--- a/py_ext/py_ext_rt.py Fri Feb 07 11:21:15 2025 +0100
+++ b/py_ext/py_ext_rt.py Fri Feb 07 14:19:42 2025 +0100
@@ -28,7 +28,7 @@
entry = csv_int_files.get(fname, None)
if entry is None:
data = list()
- csvfile = open(fname, 'rt', encoding='utf-8')
+ csvfile = open(fname, 'rb')
try:
dialect = csv.Sniffer().sniff(csvfile.read(1024))
@@ -48,7 +48,7 @@
entry = csv_str_files.get(fname, None)
if entry is None:
data = []
- csvfile = open(fname, 'rt', encoding='utf-8')
+ csvfile = open(fname, 'rb')
try:
dialect = csv.Sniffer().sniff(csvfile.read(1024))
@@ -85,7 +85,7 @@
def _CSV_Save_data(fname, dialect, data):
try:
- wfile = open(fname, 'wt')
+ wfile = open(fname, 'wb')
writer = csv.writer(wfile) if not(dialect) else csv.writer(wfile, dialect)
for row in data:
writer.writerow(row)