1. Chris Mutel
  2. brightway2


Chris Mutel  committed 45c2413

Fix JSON writing to file bug

  • Participants
  • Parent commits 27d026d
  • Branches default

Comments (0)

Files changed (3)

File brightway2/__init__.py

View file
 # -*- 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/meta.py

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

File brightway2/serialization.py

View file
 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):