beetbox / confuse

painless YAML config files for Python
https://pypi.org/project/confuse/
MIT License
414 stars 51 forks source link

Permission denied fallback directory #70

Open sbrugman opened 4 years ago

sbrugman commented 4 years ago

We use confuse for pandas-profiling. Multiple users have reported the same Permission Denied issue: https://github.com/pandas-profiling/pandas-profiling/issues/214. This issue is blocking usage of the package effectively.

The directory creation is not surrounded with a try/except block: https://github.com/beetbox/confuse/blob/master/confuse.py#L996 When it attempts to create a global directory, it might not be permitted to do so. It could fall back to the current directory for example.

Moreover, #61 fixes a problem where comments cannot be inline, which is also problematic, but non-blocking.

sampsyo commented 4 years ago

Got it; thanks for pointing this out! I think we should change either read or user_config_path, leaving config_dir alone (as its docstring says, the goal of that function is to ensure that the directory exists, so raising an OSError should be expected).

Any chance I could convince you or someone else involved in pandas-profiling to help out with an initial PR?

sbrugman commented 4 years ago

It seems that initializing the confuse.Configuration object with read=False is a workaround for the way we are using confuse.

Confuse is in the pandas-profiling dependency tree, so it can expect to have 100k+ downloads a month. This might be motivation for anyone interested in picking this up ;)