Commits

Chris Mutel committed 7fccdae

Try allowing temporary directory is home is not writeable (i.e. for read the docs)

  • Participants
  • Parent commits a308a4e

Comments (0)

Files changed (1)

File brightway2/_config.py

 # -*- coding: utf-8 -*
 import os
+import tempfile
 
 
 class Config(object):
     def reset(self, path=None):
         """Reset to original configuration. Useful for testing."""
         self.dir = self.get_home_directory(path)
+        if not os.access('/path/to/folder', os.W_OK):
+            print "Using temporary directory:"
+            self.dir = tempfile.mkdtemp()
+            print self.dir
+            print "Your changes will not be saved! Set a writeable directory!"
         self.check_dir()
 
     def get_home_directory(self, path):