Chris Mutel avatar Chris Mutel committed 839e683

Create basic directories in tempdir because web UI wants to open error log

Comments (0)

Files changed (1)


             self.dir = tempfile.mkdtemp()
             self.is_temp_dir = True
             if not getattr(self, "dont_warn", False):
-                warnings.warn("\n\tYour changes will not be saved!\n"
-                    "\tSet a writeable directory!\n"
-                    "\tCurrent data directory is:\n"
-                    "\t%s" % self.dir, UserWarning)
+                warnings.warn(u"\n\tYour changes will not be saved!\n"
+                              u"\tSet a writeable directory!\n"
+                              u"\tCurrent data directory is:\n"
+                              u"\t%s" % self.dir, UserWarning
+                    )
+            # Has to come here, because web interface wants
+            # to open a log ASAP
+            self.create_basic_directories()
     def load_preferences(self):
         if path:
-            self._dir_from = "user provided"
+            self._dir_from = u"user provided"
             return path
         user_dir = os.path.expanduser("~")
         envvar = os.getenv("BRIGHTWAY2_DIR")
         if envvar:
-            self._dir_from = "environment variable"
+            self._dir_from = u"environment variable"
             return envvar
         for filename in (".brightway2path", "brightway2path.txt"):
-            self._dir_from = "default"
+            self._dir_from = u"default"
             return os.path.join(user_dir, "brightway2")
     def request_dir(self, dirname):
     def _set_dir(self, d):
         self._dir = d
         if not self.check_dir():
-            raise OSError("This directory is not writeable")
+            raise OSError(u"This directory is not writeable")
     dir = property(_get_dir, _set_dir)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.