Browse Source

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

byungnam 4 years ago
parent
commit
0dadf3e8c1
1 changed files with 2 additions and 1 deletions
  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)