I've used two options in the past. The one is as Kent suggested, by using a
module that is imported by all others and share the values.
This doesn't allow for users to change the values, without changing the
code.

The second is to make use of a other file format. I used xml with all the
info in and extracted the values from there. It can be done with any type of
file, as long as you will know how to get the correct attributes for each
value.

HTH

Johan 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Kent Johnson
Sent: 01 February 2007 04:18 PM
To: Andreas Kostyrka
Cc: tutor@python.org
Subject: Re: [Tutor] The best way to implement a config file ???

Andreas Kostyrka wrote:
> * Magnus Wirström <[EMAIL PROTECTED]> [070201 14:38]:
>> Hi everyone
>>
>> I'm learning to program python with wxpython gui. I have a 
>> application i made with several modules and i want to implement a 
>> configfile that applies to all those modules. Is there an easy way to 
>> do this ?  Can anyone point me in the right direction ?
> 
> Depending upon your tastes:
> 
> ConfigFile => win.ini style config files.
> shlex      => unix shell script style parsing.

You can also use a python module as a shared config; just define whatever
values you want in Python code and import the module where you need it.

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.18/662 - Release Date: 2007/01/31
03:16 PM
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.18/662 - Release Date: 2007/01/31
03:16 PM
 

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to