shaypal5 / skift

scikit-learn wrappers for Python fastText.
MIT License
234 stars 23 forks source link

os.makedirs(TEMP_DIR, exist_ok=True) causes PermissionError in docker container #6

Closed crouffer closed 5 years ago

crouffer commented 5 years ago

Running skift in a docker container results in permission errors when trying to load previously generated models.

File "/usr/local/lib/python3.5/dist-packages/skift/util.py", line 10, in PermissionError: [Errno 13] Permission denied: '/root/.temp'

The problem is the docker container is running as user 'root', but the /root/ folder is not writable.

I have a fix, and will open a pull request shortly

shaypal5 commented 5 years ago

Oh, I agree whoeheatedly. I wrote this package before I knew about the XDG Base Directory Specification.

I chose a very bad place for a user-based temp directory. Nevertheless, I think using .config/skift/, even if it is appropriate for the regular user use-case, probably won't solve this problem with root.

I'd love to hear about your fix. How about using /opt? Isn't it basically where packages should put things they need when they are installed? And I do believe all users can read and write to /opt.

crouffer commented 5 years ago

This is fixed in https://github.com/shaypal5/skift/pull/7