[Tutor] The best way to implement a config file ???
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 ? Thanks Magnus ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The best way to implement a config file ???
* 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. Andreas ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The best way to implement a config file ???
Andreas Kostyrka skrev: * 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. Andreas / think i want win.ini style, I'm designing a configuration module that is going to write this file. I have not heard of shlex so i can really not judge if it suits my needs. I do like the kind of config file that can be editable with a editor if nessary. Anyone have an good example how to use ConfigFile to write a config file that stores strings and boolean settings. Sorry for my english Thanks Magnus / ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The best way to implement a config file ???
Magnus Wirström wrote: / think i want win.ini style, I'm designing a configuration module that is going to write this file. I have not heard of shlex so i can really not judge if it suits my needs. I do like the kind of config file that can be editable with a editor if nessary. Anyone have an good example how to use ConfigFile to write a config file that stores strings and boolean settings. Sorry for my english http://effbot.org/librarybook/configparser.htm There are also a bunch of third-party modules that are supposed to be better than ConfigParser in some way: http://wiki.python.org/moin/ConfigParserShootout Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The best way to implement a config file ???
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