[Tutor] where to put configuration files

Kirk Bailey idiot1@netzero.net
Sat Jun 7 20:36:02 2003


Paul Tremblay wrote:
> On Fri, Jun 06, 2003 at 06:04:00PM -0700, Sean 'Shaleh' Perry wrote:
> 
>>From: Sean 'Shaleh' Perry <shalehperry@attbi.com>
>>To: tutor@python.org
>>Subject: Re: [Tutor] where to put configuration files
>>User-Agent: KMail/1.5.1
>>Date: Fri, 6 Jun 2003 18:04:00 -0700
>>
>>On Friday 06 June 2003 16:05, Paul Tremblay wrote:
>>
>>>I have written a script that requires a configuration file. I have
>>>written an additional script that configures my setup.py, as well as the
>>>origninal script, as to where the user decides to put the configuration
>>>file.
>>>
>>>This configuration file is kind of a pain to have to maintain. Is it
>>>okay to just dump configuration files in /etc, or is this considered bad
>>>practice?
>>>
>>
>>If you *EVER* intend this to be real software used by real users, yes /etc is 
>>the place to go.  It is probably a good idea to create a subdir and place the 
>>config in there.  Something like /etc/mypackage/foo.conf.

we got plastic users on this list?!?

> 
> 
> R. Alan Monroe wrote me off this mailing list and pointed out that
> Windows users have no /etc/ directory. Mac OS X users do. 

We jeez, we ARE talking about WINDOWS, it's not suprising it's deficent.

> 
> He pointed out that I should just lump the configuration file with the
> "rest." I assume he means that I should put it wherever the modules are
> installed. (For example,
> /usr/lib/python/site-packages/my_special_module/configuration_dir/configure)
> However, how do I tell the actual script to look there? 
That is a question that gained my attention early on. I put the .cf file right where the 
program is that wants to read it. it can always open it's own dir, and can find it's own 
location very simply. SOME people live in servers which are rather restricted; tehy can 
run cgi scripts, but cannot get into some system areas, like '/etc'. And indeed, either 
you have to hack the script so it knows where to go look, or offer it a local file to 
read- say, that's almost a cf file all by itself!

> 
> After all, a user could decide to put the module in
> /home/me/my_python_lib.
> 
> I suppose I could simply search the sys.path:
> 
> for path_dir in sys.path:
>  if os.path.exits(path_dir + 'my_module/config'):
>    config_file = path_dir + 'my_modulce/config'
>    break
> 
> 
> 
> But then, that could cause problems.

Sure could. system problems even operator confusion problems. Let me gently remind the 
users of the KISS principle.
>  The user installs version 1.0 in /home/my_python_lib/.
> 
> He then installs version 1.1 in /usr/lib/python/site-packages.
> 
> The script searches the sys.path list, and finds an *old* configuration
> file first, and stops searching.
> 
> I have noticed that "real" software simply sticks the configuration in
> /etc/whatever. I think the attitude is "You better have access to /etc,
> and you better have a directory called /etc.
And what if I don't? I can pound sand, apparently. Or go use someone else's software. 
But they sure can turn their noses up at me righously, heh?

Apparently, being Politically Correct is worming it's way into compute programming. 
THANK GODDESS I'm an amateur.

> 
> Thanks
> 
> Paul
> 


-- 

end

Cheers!
         Kirk D Bailey
                               think
http://www.howlermonkey.net/ +-----+ http://www.tinylist.org/
http://www.listville.net/    | BOX | http://www.sacredelectron.org/
                              +-----+
"Thou art free"-ERIS          think    'Got a light?'-Promethieus

.