[Tutor] where to put configuration files

Paul Tremblay phthenry@earthlink.net
Wed Jun 11 00:13:01 2003


On Tue, Jun 10, 2003 at 10:40:41AM -0700, Jeff Shannon wrote:
 
> Paul Tremblay wrote:
> 
> >How can I make a universal rule to parse __file__ in order to get the
> >location of data.txt? The actual data.txt can exist many levels up from
> >the actual module.
> >
> >Or do I actually put the data.txt *in* foo to begin with? But if I do
> >that, wont' the install utility try to see it as a python file?
> > 
> >
> 
> If you're using a module's __file__, then you'd probably want to put 
> that config file directly in the foo directory (or a subdirectory of 
> it), yes.  To be honest, I can't say for sure how that'll affect the 
> installer (I do all my work in-house, mostly directly on a server, so I 
> almost never have a need for distutils...) but I'd be surprised if 
> something couldn't be arranged.  
> 

I think I'm finally seeing what is meant by stick everything in one
directory. 

It simply means put *everything* in one directory, and have the user put
the directory wherever s/he wants.

I actually wrote a script with ten modules like this in perl, so I
should have known exactly what you meant. Yes, it is simple.

However, I was thinking along the lines of having to use disutils. I
assumed that a developer should use setup.py. I assumed it was just
expected, and not using setup.py indicated a hack.

It does seem that a configuration file is a somewhat unresolved issue in
python. So far as I can tell from this thread, there is no bullet-proof
way to make sure a configuration file will always get where it is
supposed to on all platforms.

Paul

-- 

************************
*Paul Tremblay         *
*phthenry@earthlink.net*
************************