From 6cde2003f4fa6f8ba33dff51974d2f320f7b40b9 Mon Sep 17 00:00:00 2001 From: David Vierra Date: Mon, 29 Oct 2012 21:51:44 -1000 Subject: [PATCH] Fixed: Log the exception in materials.py when pkg_resources fails to load a yaml file. --- materials.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/materials.py b/materials.py index e9b9399..c0c7ef8 100644 --- a/materials.py +++ b/materials.py @@ -156,7 +156,11 @@ class MCMaterials(object): f = pkg_resources.resource_stream(__name__, filename) except (ImportError, IOError): 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: info(u"Loading block info from %s", f) blockyaml = yaml.load(f)