Browse Source

Add info on writing data files to FAQ

Thomas Kluyver 8 years ago
parent
commit
3e46d0572f
1 changed files with 11 additions and 0 deletions
  1. 11 0
      doc/faq.rst

+ 11 - 0
doc/faq.rst

@@ -40,6 +40,17 @@ list them in the ``files`` key of the ``[Include]`` section of the config file.
 Your code can find them relative to the location of the launch script running your
 application (``sys.modules['__main__'].__file__``).
 
+.. note::
+
+   The techniques above work for fixed data files which you ship with your
+   application. For files which your app will *write*, you should use another
+   location, because an app installed systemwide cannot write files in its
+   install directory. Use the ``APPDATA`` or ``LOCALAPPDATA`` environment
+   variables as locations to write hidden data files (`what's the difference?
+   <https://superuser.com/a/21462/209976>`__)::
+
+       writable_file = os.path.join(os.environ['LOCALAPPDATA'], 'MyApp', 'file.dat')
+
 Code signing
 ------------