Chris Mutel committed 45c2413

Fix JSON writing to file bug

  • Participants
  • Parent commits 27d026d

Comments (0)

Files changed (3)

File brightway2/

 # -*- coding: utf-8 -*
 from _config import config
-from meta import databases, methods, mapping
+from meta import databases, methods, mapping, reset_meta
 from database import Database
 from method import Method
 from query import Query, Filter, Result

File brightway2/

 mapping = Mapping()
 databases = Databases()
 methods = Methods()
+def reset_meta():
+    mapping.__init__()
+    databases.__init__()
+    methods.__init__()

File brightway2/

 class JsonWrapper(object):
     def dump(self, data, file):
-        if anyjson:
-            with open(file, "w") as f:
+        with open(file, "w") as f:
+            if anyjson:
-        else:
-            json.dump(data, file, indent=2)
+            else:
+                json.dump(data, f, indent=2)
     def load(self, file):