Deutsch   English   Français   Italiano  
<100sn6t$oj7m$3@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: "Michael F. Stemper" <michael.stemper@gmail.com>
Newsgroups: comp.lang.python
Subject: Re: Best practice for config files?
Date: Sat, 24 May 2025 10:05:01 -0500
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <100sn6t$oj7m$3@dont-email.me>
References: <100nvn0$3kq1t$1@dont-email.me>
 <config-20250522212305@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 24 May 2025 17:05:01 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7294d9f42f434efa248e506a9994f729";
	logging-data="806134"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/agzMHN9LpzrJYswpMOaQKuKrFw5YrnAU="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Cancel-Lock: sha1:bxzk/5oZ9ynPcH3Hg3xUFNilh1k=
Content-Language: en-US
In-Reply-To: <config-20250522212305@ram.dialup.fu-berlin.de>
Bytes: 2541

On 22/05/2025 15.27, Stefan Ram wrote:
> "Michael F. Stemper" <michael.stemper@gmail.com> wrote or quoted:
>> Should I specify the location of the config file with a command-line
>> option, or is requiring the program to be executed in the directory
>> containing the configuration file considered acceptable practice?
> 
>    It was me who digged out this "platformdirs" "user_config_dir"
>    API using a source code search on my harddisk without any help.
>    But then I asked my buddy, the chatbot, to explain how to
>    use it, which I include here, followed by some more words
>    of my own at the end. Chatbot:

[massive snip]

>    On Linux:
> 
> ~/.config/YourAppName

[another one]


Wow, if that's the best practice, I'll settle for second-best!

Somebody who wished to remain anonymous contacted me via email and
suggested that I could have my cake and eat it, too. I am going
ahead with having a default location for the config file, as well
as a command-line option to specify a different file. Blindingly
obvious!

And the default will not be in the directory in which the program
is being run. Your post reminded me of the existence of $HOME/.config
which is obviously the right place for it.

Thanks for all of the suggestions.

-- 
Michael F. Stemper
I refuse to believe that a corporation is a person until Texas executes one.