1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
# From: Jordan Metzmeier <jmetzmeier01@gmail.com>
# Subject: Use codecs.open for reading files so utf-8 is properly
# handled in both python2 and 3
--- a/crontab.py
+++ b/crontab.py
@@ -90,6 +90,7 @@
import os
import re
import sys
+import codecs
import tempfile
import subprocess as sp
@@ -229,7 +230,7 @@
lines = self.intab.split('\n')
elif filename:
self.filen = filename
- with open(filename, 'r') as fhl:
+ with codecs.open(filename, 'r', encoding='utf-8') as fhl:
lines = fhl.readlines()
else:
(out, err) = pipeOpen(CRONCMD, l='', u=self.user).communicate()
|