可以指定配置文件或者禁止新建配置文件目录吗
shirohako opened this issue · 2 comments
shirohako commented
其他程序使用没有权限的用户的话会报错
Traceback (most recent call last):
File "/usr/lib/python3.10/pathlib.py", line 1175, in mkdir
self._accessor.mkdir(self, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/www/.config/meme_generator'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/pathlib.py", line 1175, in mkdir
self._accessor.mkdir(self, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/www/.config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/meme", line 5, in <module>
from meme_generator.cli import main
File "/usr/local/lib/python3.10/dist-packages/meme_generator/__init__.py", line 3, in <module>
from meme_generator.config import meme_config as config
File "/usr/local/lib/python3.10/dist-packages/meme_generator/config.py", line 10, in <module>
config_file_path = get_config_file("config.toml")
File "/usr/local/lib/python3.10/dist-packages/meme_generator/dirs.py", line 216, in get_config_file
return get_config_dir() / filename
File "/usr/local/lib/python3.10/dist-packages/meme_generator/dirs.py", line 195, in wrapper
_ensure_dir(path)
File "/usr/local/lib/python3.10/dist-packages/meme_generator/dirs.py", line 187, in _ensure_dir
path.mkdir(parents=True, exist_ok=True)
File "/usr/lib/python3.10/pathlib.py", line 1179, in mkdir
self.parent.mkdir(parents=True, exist_ok=True)
File "/usr/lib/python3.10/pathlib.py", line 1179, in mkdir
self.parent.mkdir(parents=True, exist_ok=True)
File "/usr/lib/python3.10/pathlib.py", line 1175, in mkdir
self._accessor.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied: '/home/www'
MeetWq commented
目前没法指定配置文件,可以通过XDG_CONFIG_HOME
环境变量来改变配置文件路径
shirohako commented
目前没法指定配置文件,可以通过
XDG_CONFIG_HOME
环境变量来改变配置文件路径
已解决,感谢好思路