瀏覽代碼

fix poole.py for utf-8 compatibility

Thomas Buck 3 年之前
父節點
當前提交
cc72514889
共有 1 個檔案被更改,包括 4 行新增2 行删除
  1. 4
    2
      poole.py

+ 4
- 2
poole.py 查看文件

@@ -1,4 +1,5 @@
1 1
 #!/usr/bin/env python2
2
+# -*- coding: utf-8 -*-
2 3
 
3 4
 # =============================================================================
4 5
 #
@@ -61,7 +62,8 @@ else:
61 62
     import tempfile
62 63
     def exec_(code, envdic):
63 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 67
             tf.flush()
66 68
             execfile(tf.name, envdic)
67 69
 
@@ -388,7 +390,7 @@ def build(project, opts):
388 390
         """Abort because of an exception in inlined Python code."""
389 391
         print("abort  : Python %s in %s failed" % (itype, page))
390 392
         print((" %s raising the exception " % itype).center(79, "-"))
391
-        print(inline)
393
+        print(inline.encode('utf-8'))
392 394
         print(" exception ".center(79, "-"))
393 395
         print(exc)
394 396
         sys.exit(1)

Loading…
取消
儲存