fix imports

This commit is contained in:
jomo
2014-07-19 02:02:42 +02:00
parent 16c95e4a12
commit ccd0e3cd09

View File

@@ -6,7 +6,7 @@ import org.bukkit.Location as Location
import org.bukkit.entity.Player as Player import org.bukkit.entity.Player as Player
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause as TeleportCause import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause as TeleportCause
import org.bukkit.block as bblock import org.bukkit.block as bblock
from json import dumps as json.dumps, loads as json.loads from json import dumps as json_dumps, loads as json_loads
shared = {} # this dict can be used to share stuff across modules shared = {} # this dict can be used to share stuff across modules
@@ -116,7 +116,7 @@ def retrieve_player(uid):
def open_json_file(json_filename): # json file is the path + name to the file def open_json_file(json_filename): # json file is the path + name to the file
try: try:
with open(json_file) as obj: with open(json_file) as obj:
return json.loads(obj.read()) return json_loads(obj.read())
except Exception, reading_error: except Exception, reading_error:
error("Failed to read from %s: %s" % (json_file, str(reading_error))) error("Failed to read from %s: %s" % (json_file, str(reading_error)))
@@ -124,6 +124,6 @@ def open_json_file(json_filename): # json file is the path + name to the file
def save_json_file(json_filename, json_object): # json file is the path + name to the file, json_object is the variable you want to write to the file. def save_json_file(json_filename, json_object): # json file is the path + name to the file, json_object is the variable you want to write to the file.
try: try:
with open(json_file) as obj: with open(json_file) as obj:
obj.write(json.dumps(json_object)) obj.write(json_dumps(json_object))
except Exception, writing_error: except Exception, writing_error:
error("Failed to write to %s: %s" % (json_file, str(writing_error))) error("Failed to write to %s: %s" % (json_file, str(writing_error)))