In the context of models.py, os.path.dirname(__file__) will return the directory that the models.py is located. As a result, when models.train_models() (or any other function which writes to file in that module) is called, it invariably writes to the location that the library was installed to (if installed via pip).
This will cause permission denied errors if the module was installed to the system install location via sudo. Even if this is not the case, this will clutter up the directory that the module was installed to with user data (and there's also a possibility that it might actually overwrite one of the files that are a part of the library).
In the context of
models.py
,os.path.dirname(__file__)
will return the directory that themodels.py
is located. As a result, whenmodels.train_models()
(or any other function which writes to file in that module) is called, it invariably writes to the location that the library was installed to (if installed via pip).This will cause permission denied errors if the module was installed to the system install location via
sudo
. Even if this is not the case, this will clutter up the directory that the module was installed to with user data (and there's also a possibility that it might actually overwrite one of the files that are a part of the library).I have a patch for this in https://github.com/DecodedCo/autocomplete/commit/f13d3e9f7a6edf7ed1dbad8cd3cbfbd333ec0bb0, which I will open a pull request for once tested.