Explorar o código

Open file with 'w' if python version is 3, else 'w+b'

byungnam %!s(int64=4) %!d(string=hai) anos
pai
achega
0dadf3e8c1
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      desktop/core/src/desktop/lib/metrics/file_reporter.py

+ 2 - 1
desktop/core/src/desktop/lib/metrics/file_reporter.py

@@ -17,6 +17,7 @@
 import json
 import logging
 import os
+import sys
 import tempfile
 
 from pyformance.reporters.reporter import Reporter
@@ -46,7 +47,7 @@ class FileReporter(Reporter):
     # rename the file to the real location.
 
     f = tempfile.NamedTemporaryFile(
-        mode='w',
+        mode='w' if sys.version_info[0] > 2 else 'w+b',
         dir=dirname,
         delete=False)