This is my first time writing a python module so I don't know some customs. My module needs to write data and store it somewhere. I decided to do so in some nested folder underneath the location of my modules egg within site-packages.
However, when running the script on a computer after installing it via setup.py,
I'm getting errors when trying to create a directory. I managed to get around creating/reading from files by making all my
open('file.txt', 'r+') # into
open('file.txt', 'r')
# and same respectively for writes.
# os.mkdir() is causing an IOError permissions denied.
But it still won't let me create directories! Via an IOError
permissions denied.
NOTE: I'm aware that you can write/read anything from some special dirs, like /tmp
, but I'd prefer to do it in the egg.
I feel that this task is a must do also, does anyone have any ideas?
Application data should be stored under either
%APPDATA%
,$XDG_CONFIG_HOME
, or~/.config
, depending on the platform. Create a directory for the module within one of those locations. Or better yet, have the application tell you where your data should be located.