Skip to content

Commit

Permalink
Open file with 'w' if python version is 3, else 'w+b'
Browse files Browse the repository at this point in the history
  • Loading branch information
byungnam authored and romainr committed Aug 19, 2021
1 parent 2e6e134 commit 0dadf3e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion desktop/core/src/desktop/lib/metrics/file_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import json
import logging
import os
import sys
import tempfile

from pyformance.reporters.reporter import Reporter
Expand Down Expand Up @@ -46,7 +47,7 @@ def report_now(self, registry=None, timestamp=None):
# 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)

Expand Down

0 comments on commit 0dadf3e

Please sign in to comment.