File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 3
3
import sys
4
4
import struct
5
5
import subprocess
6
+ import codecs
6
7
7
8
8
9
def get_sys_info ():
@@ -99,14 +100,13 @@ def show_versions(as_json=False):
99
100
except :
100
101
import simplejson as json
101
102
102
- j = json .dumps (
103
- dict (system = dict (sys_info ), dependencies = dict (deps_blob )), indent = 2 )
103
+ j = dict (system = dict (sys_info ), dependencies = dict (deps_blob ))
104
104
105
105
if as_json == True :
106
106
print (j )
107
107
else :
108
- with open (as_json , "wb" ) as f :
109
- f . write ( j )
108
+ with codecs . open (as_json , "wb" , encoding = 'utf8' ) as f :
109
+ json . dump ( j , f , indent = 2 )
110
110
111
111
else :
112
112
@@ -120,6 +120,7 @@ def show_versions(as_json=False):
120
120
for k , stat in deps_blob :
121
121
print ("%s: %s" % (k , stat ))
122
122
123
+
123
124
def main ():
124
125
# optparse is 2.6-safe
125
126
from optparse import OptionParser
@@ -137,4 +138,4 @@ def main():
137
138
return 0
138
139
139
140
if __name__ == "__main__" :
140
- sys .exit (main ())
141
+ sys .exit (main ())
You can’t perform that action at this time.
0 commit comments