Fixed: Log the exception in materials.py when pkg_resources fails to load a yaml file.
This commit is contained in:
parent
03c6baa42d
commit
6cde2003f4
@ -156,7 +156,11 @@ class MCMaterials(object):
|
|||||||
f = pkg_resources.resource_stream(__name__, filename)
|
f = pkg_resources.resource_stream(__name__, filename)
|
||||||
except (ImportError, IOError):
|
except (ImportError, IOError):
|
||||||
root = os.environ.get("PYMCLEVEL_YAML_ROOT", "pymclevel") # fall back to cwd as last resort
|
root = os.environ.get("PYMCLEVEL_YAML_ROOT", "pymclevel") # fall back to cwd as last resort
|
||||||
f = file(join(root, filename))
|
path = join(root, filename)
|
||||||
|
|
||||||
|
log.exception("Failed to read %s using pkg_resources. Trying %s instead." % (filename, path))
|
||||||
|
|
||||||
|
f = file(path)
|
||||||
try:
|
try:
|
||||||
info(u"Loading block info from %s", f)
|
info(u"Loading block info from %s", f)
|
||||||
blockyaml = yaml.load(f)
|
blockyaml = yaml.load(f)
|
||||||
|
Reference in New Issue
Block a user