File: python3.patch

package info (click to toggle)
python-mne 0.19.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 100,440 kB
  • sloc: python: 120,243; pascal: 1,861; makefile: 225; sh: 15
file content (24 lines) | stat: -rw-r--r-- 997 bytes parent folder | download
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>')