1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
Description: Fix Python 3 issue
Author: Thomas Goirand <zigo@debian.org>,
Jaakko Leppakangas
Last-Update: Sun, 01 Sep 2019 14:38:58 +0200
--- a/mne/report.py
+++ b/mne/report.py
@@ -1375,9 +1375,13 @@ class Report(object):
include = list()
for inc_fname in inc_fnames:
logger.info('Embedding : %s' % inc_fname)
- fname = op.join(op.dirname(__file__), 'html', inc_fname)
- with open(fname, 'rb') as fid:
- file_content = fid.read().decode('utf-8')
+ if not os.path.isabs(inc_fname):
+ inc_fname = op.join(op.dirname(__file__), 'html', inc_fname)
+ f = open(inc_fname, 'r')
+ if PY3:
+ file_content = f.read()
+ else:
+ file_content = f.read().decode('UTF-8')
if inc_fname.endswith('.js'):
include.append(u'<script type="text/javascript">' +
file_content + u'</script>')
|