Browse Source

fix poole.py for utf-8 compatibility

Thomas Buck 3 years ago
parent
commit
cc72514889
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      poole.py

+ 4
- 2
poole.py View File

1
 #!/usr/bin/env python2
1
 #!/usr/bin/env python2
2
+# -*- coding: utf-8 -*-
2
 
3
 
3
 # =============================================================================
4
 # =============================================================================
4
 #
5
 #
61
     import tempfile
62
     import tempfile
62
     def exec_(code, envdic):
63
     def exec_(code, envdic):
63
         with tempfile.NamedTemporaryFile() as tf:
64
         with tempfile.NamedTemporaryFile() as tf:
64
-            tf.write(code)
65
+            tf.write('# -*- coding: utf-8 -*-\n')
66
+            tf.write(code.encode('utf-8'))
65
             tf.flush()
67
             tf.flush()
66
             execfile(tf.name, envdic)
68
             execfile(tf.name, envdic)
67
 
69
 
388
         """Abort because of an exception in inlined Python code."""
390
         """Abort because of an exception in inlined Python code."""
389
         print("abort  : Python %s in %s failed" % (itype, page))
391
         print("abort  : Python %s in %s failed" % (itype, page))
390
         print((" %s raising the exception " % itype).center(79, "-"))
392
         print((" %s raising the exception " % itype).center(79, "-"))
391
-        print(inline)
393
+        print(inline.encode('utf-8'))
392
         print(" exception ".center(79, "-"))
394
         print(" exception ".center(79, "-"))
393
         print(exc)
395
         print(exc)
394
         sys.exit(1)
396
         sys.exit(1)

Loading…
Cancel
Save