fixed an oversight and renamed some moar variables
parent
d389253d0b
commit
1b10e6a6ea
|
@ -12,18 +12,18 @@ if not len(sys.argv)==3:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
print "Reading config file...",
|
print "Reading config file...",
|
||||||
config = open(sys.argv[2],"r")
|
config_file = open(sys.argv[2],"r")
|
||||||
parsed = json.loads(config.read().decode("utf-8"))
|
config_values = json.loads(config_file.read().decode("utf-8"))
|
||||||
config.close()
|
config_file.close()
|
||||||
print "Done."
|
print "Done."
|
||||||
|
|
||||||
print "Working on file: "+sys.argv[1]
|
print "Working on file: "+sys.argv[1]
|
||||||
for x in parsed:
|
for variable in config_values:
|
||||||
print x,
|
print variable,
|
||||||
file_in = open(sys.argv[1], "r")
|
file_in = open(sys.argv[1], "r")
|
||||||
file_content = file_in.read()
|
file_content = file_in.read()
|
||||||
file_in.close()
|
file_in.close()
|
||||||
file_out = open(file_path, "w")
|
file_out = open(sys.argv[1], "w")
|
||||||
file_out.write(file_content.decode('utf-8').replace("%" + x + "%", parsed[x]).encode('utf-8'))
|
file_out.write(file_content.decode('utf-8').replace("%" + variable + "%", config_values[variable]).encode('utf-8'))
|
||||||
file_out.close()
|
file_out.close()
|
||||||
print "\nDone."
|
print "\nDone."
|
||||||
|
|
Loading…
Reference in New Issue