Remove use of json so as to support python 2.4 and 2.5

This commit is contained in:
Andrew Cammell 2014-10-07 20:48:38 +08:00
parent 20257151f4
commit ad57c7cf2e
1 changed files with 4 additions and 5 deletions

View File

@ -30,7 +30,6 @@ import signal
import socket
import timeit
import threading
from json import dump as jsonDump, load as jsonLoad
# Used for bound_interface
socket_socket = socket.socket
@ -562,7 +561,7 @@ def speedtest():
print_('Unable to open configuration file %s'
% args.saveconfig)
sys.exit(1)
jsonDump(config, configfile)
configfile.write(str(config))
configfile.close()
else:
if not args.simple:
@ -573,7 +572,7 @@ def speedtest():
except:
print_('Unable to open configuration file %s' % args.loadconfig)
sys.exit(1)
config = jsonLoad(confFile)
config = eval(confFile.read())
confFile.close()
if args.showconfig:
@ -616,7 +615,7 @@ def speedtest():
except:
print_('Unable to open server file')
sys.exit(1)
jsonDump(servers, svrFile)
svrFile.write(str(servers))
svrFile.close()
print_('Done')
sys.exit(0)
@ -629,7 +628,7 @@ def speedtest():
except:
print_('Unable to open server file')
sys.exit(1)
allServers = jsonLoad(svrFile)
allServers = eval(svrFile.read())
svrFile.close()
if len(allServers) > 10:
servers = allServers[:5]