You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
(2) |
Nov
(18) |
Dec
(26) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(14) |
Feb
(28) |
Mar
(21) |
Apr
(17) |
May
(23) |
Jun
(12) |
Jul
(12) |
Aug
(7) |
Sep
(10) |
Oct
|
Nov
(4) |
Dec
(10) |
| 2007 |
Jan
(5) |
Feb
(8) |
Mar
|
Apr
|
May
(7) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(20) |
Oct
(3) |
Nov
(2) |
Dec
(12) |
| 2008 |
Jan
(40) |
Feb
(15) |
Mar
(1) |
Apr
|
May
(6) |
Jun
(19) |
Jul
(2) |
Aug
(17) |
Sep
(13) |
Oct
(7) |
Nov
(16) |
Dec
(5) |
| 2009 |
Jan
(15) |
Feb
(11) |
Mar
(11) |
Apr
(8) |
May
(6) |
Jun
(15) |
Jul
(19) |
Aug
(2) |
Sep
|
Oct
(19) |
Nov
(1) |
Dec
(3) |
| 2010 |
Jan
(12) |
Feb
(25) |
Mar
(45) |
Apr
(4) |
May
(2) |
Jun
(4) |
Jul
(6) |
Aug
(13) |
Sep
(1) |
Oct
(2) |
Nov
(2) |
Dec
(9) |
| 2011 |
Jan
(24) |
Feb
(7) |
Mar
(1) |
Apr
(6) |
May
(3) |
Jun
(3) |
Jul
|
Aug
(13) |
Sep
(9) |
Oct
(7) |
Nov
(17) |
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
(5) |
Apr
(3) |
May
|
Jun
|
Jul
(3) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(12) |
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
(4) |
Feb
(3) |
Mar
|
Apr
(17) |
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(3) |
Oct
(3) |
Nov
|
Dec
|
| 2015 |
Jan
(11) |
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
(2) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
(10) |
Dec
|
| 2017 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Jeffrey B. <jef...@ea...> - 2007-12-18 16:51:00
|
On Tuesday 18 December 2007 09:28:16 Michael Foord wrote: > Unless there are any objections I will add code to ensure that files are > newline terminated. A side effect is that roundtripped files may gain a > newline. Avoiding this would mean storing extra state when reading files > and I don't *intend* to jump through those hoops. My program will be roundtripping constantly, once I figure out how to implement a reload method. It would be bad if the configuration file acquired a newline every roundtrip. -- Jeffrey Barish |
|
From: Michael F. <fuz...@vo...> - 2007-12-18 16:28:31
|
Frederik Elwert wrote: > Hello! > > I just discovered ConfigObj, and I really like it. But I have one > problem: ConfigObj doesn't put a newline at the end of the files it > writes. So the config file ends immediately after the value of the last > option, with no trailing newline. > > Now I want to edit configuration files for one specific application with > ConfigObj. And this application crashes with this behaviour while > reading the config file. As far as I know, the POSIX standard requires > files to end with newlines, so it seems legitimate for applications to > expect newlines at the end of a file. > > Is this behaviour intended? And is there an easy way to add a final > newline to the file? > Well - there are easy ways to add newlines to files. :-) Newline handling was actually quite tricky as ConfigObj is used to roundtrip files. I also prefer files terminated with a newline but wasn't aware it was part of the POSIX spec. Unless there are any objections I will add code to ensure that files are newline terminated. A side effect is that roundtripped files may gain a newline. Avoiding this would mean storing extra state when reading files and I don't *intend* to jump through those hoops. Michael http://www.manning.com/foord > Thanks, > Frederik > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services > for just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > > |
|
From: Frederik E. <fre...@we...> - 2007-12-17 22:59:21
|
Hello! I just discovered ConfigObj, and I really like it. But I have one problem: ConfigObj doesn't put a newline at the end of the files it writes. So the config file ends immediately after the value of the last option, with no trailing newline. Now I want to edit configuration files for one specific application with ConfigObj. And this application crashes with this behaviour while reading the config file. As far as I know, the POSIX standard requires files to end with newlines, so it seems legitimate for applications to expect newlines at the end of a file. Is this behaviour intended? And is there an easy way to add a final newline to the file? Thanks, Frederik |
|
From: Michael F. <fuz...@vo...> - 2007-12-15 22:59:31
|
Robin Munn wrote: > On Dec 15, 2007 8:17 AM, Michael Foord <fuz...@vo...> wrote: > >> Daniel Watkins wrote: >> >>> However, I'm running into problems when I want a string config option >>> to default to the empty string. If I use any of: >>> prefix = string(default='') >>> prefix = string(default="") >>> prefix = string(default=None) >>> and don't specify a value in the config file, then prefix is set to '', >>> "" >>> >> Does this *not* mean that prefix is set to an empty string? >> >> If it *does* mean that then what actually do you want to happen? >> > > I understood him to mean that the prefix gets set to one of: > > - a string consisting of two single quotes > - a string consisting of two double quotes > - a string containing the word "None" > > and what he actually wants is an empty string. > > If that is the case then I will have to test it and fix it. There is another problem with validate turning strings into lists that needs fixing. Unfortunately I am kind of tied up with writing a wretched book - so I will have to make time for it somewhere. On the other hand validate is pretty simple code so if anyone wants to send a patch (with tests)... :-) Michael http://www.manning.com/foord |
|
From: Robin M. <rob...@gm...> - 2007-12-15 19:52:49
|
On Dec 15, 2007 8:17 AM, Michael Foord <fuz...@vo...> wrote: > Daniel Watkins wrote: > > However, I'm running into problems when I want a string config option > > to default to the empty string. If I use any of: > > prefix = string(default='') > > prefix = string(default="") > > prefix = string(default=None) > > and don't specify a value in the config file, then prefix is set to '', > > "" > > Does this *not* mean that prefix is set to an empty string? > > If it *does* mean that then what actually do you want to happen? I understood him to mean that the prefix gets set to one of: - a string consisting of two single quotes - a string consisting of two double quotes - a string containing the word "None" and what he actually wants is an empty string. -- Robin Munn Rob...@gm... GPG key 0x4543D577 |
|
From: Michael F. <fuz...@vo...> - 2007-12-15 14:17:46
|
Daniel Watkins wrote: > Hi guys, > > A couple of friends and I are writing an IRC bot, uChoob[0], and until > relatively recently were using ConfigParser. However, we found that it > didn't live up to our needs. As I'm a contributor to Bazaar, I took a > look at what they used, which brought us to ConfigObj. > > First of all, I'd like to thank you for an excellent project. It's > made life much easier for us. Part of what has made it particularly > easy is the validation and type marshalling that you do for us, through > validate.py. > > However, I'm running into problems when I want a string config option > to default to the empty string. If I use any of: > prefix = string(default='') > prefix = string(default="") > prefix = string(default=None) > and don't specify a value in the config file, then prefix is set to '', > "" Does this *not* mean that prefix is set to an empty string? If it *does* mean that then what actually do you want to happen? Michael http://www.manning.com/foord > or 'None' respectively. If I use > prefix = string(default=) > then no default is set and I get a validation error. > > Is there any way to get around this? > > > Cheers, > > Dan > > > [Footnote 0: This should actually be mu-Choob, but ANSI didn't think to > include the Greek alphabet in the 128 characters available > to them. :p] > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services > for just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > ------------------------------------------------------------------------ > > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > |
|
From: Daniel W. <D.M...@wa...> - 2007-12-14 01:33:00
|
Hi guys,
A couple of friends and I are writing an IRC bot, uChoob[0], and until
relatively recently were using ConfigParser. However, we found that it
didn't live up to our needs. As I'm a contributor to Bazaar, I took a
look at what they used, which brought us to ConfigObj.
First of all, I'd like to thank you for an excellent project. It's
made life much easier for us. Part of what has made it particularly
easy is the validation and type marshalling that you do for us, through
validate.py.
However, I'm running into problems when I want a string config option
to default to the empty string. If I use any of:
prefix =3D string(default=3D'')
prefix =3D string(default=3D"")
prefix =3D string(default=3DNone)
and don't specify a value in the config file, then prefix is set to '',
"" or 'None' respectively. If I use
prefix =3D string(default=3D)
then no default is set and I get a validation error.
Is there any way to get around this?
Cheers,
Dan
[Footnote 0: This should actually be mu-Choob, but ANSI didn't think to
include the Greek alphabet in the 128 characters available
to them. :p]
--=20
Daniel Watkins (Odd_Bloke)
University of Warwick Christian Focus President
University of Warwick Computing Society WUGLUG Liaison Officer
|
|
From: Michael F. <fuz...@vo...> - 2007-12-07 12:06:12
|
Jeffrey Barish wrote: > Is there an easy way to reload the config file, e.g., a reload method? One > part of my program is modifying the config file, so I want to be sure that > another part is using the latest values. > A reload method sounds like a good idea. Patches welcomed of course. It *might* already work if you just call '__init__' again with the same filename, but isn't recommended. :-) Michael http://www.manning.com/foord |
|
From: Jeffrey B. <jef...@ea...> - 2007-12-06 21:25:42
|
Is there an easy way to reload the config file, e.g., a reload method? One part of my program is modifying the config file, so I want to be sure that another part is using the latest values. -- Jeffrey Barish |
|
From: Pettit, K. (SAIC) <Kei...@bp...> - 2007-12-04 18:20:21
|
I had a need for a application I was doing to have multiple levels of
configuration. On top of that I also needed to take into account
commandline options from the optparse module. Also needed to make
certain options immutable. So this is my hack which works pretty well
for me. Anyways I thought my solition to that problem might help this
group.
The order I look at the config files, and my particular need.
1) SiteConfig - Global defaults, this is my Spec file. In the Spec I
specify any global options defaults I need
2) UserConfig - The first config I look at
3) ProjectConfig - Config's for a specific project
Additional Features I needed:
* Immutable: I made a immutable option that users can put in any of the
config files, so the next config that is looked at will not overwrite
it's option. In the config if there is a immutable value it will look
at the results and make those immutable. For example if your config had
something like:
Org =3D "Power Plant"
First =3D "Homer"
Last =3D "Simpson"
Immutable =3D "Org" #This can be a list of options to make immutable
* OptParse - I like optparse for commandline options and needed to merge
options form optparse and configobj, I also needed to let the user play
a trump card so the commandline could overwrite any previous options,
even if it was set as immutable. Weird but we needed it.
If this is usefull to anybody let me know and I can create a example
script with config's, or maybe I could spend the time and figure out how
to put this into configobj. That might be beyond me though.
Keith
###################################
# Config functions
###################################
"config" is the dictionary I create to hold the configobj configs and
optparse options. =20
# UserConfig
def config_usermerge(userconfigfile, config):
userconfig =3D ConfigObj(userconfigfile, interpolation=3D"Template")
val =3D Validator()
config.validate(val, copy=3DTrue)
for key, value in config.iteritems():
# If marked as Immutable do not update value
if key not in config['immutable']:
config[key] =3D value #Update config with new value
val =3D Validator()
config.validate(val, copy=3DTrue)
return config
#Overwrite "config" with project config
def config_projmerge(projconfigfile, config):
projconfig =3D ConfigObj(projconfigfile, interpolation=3D"Template")
val =3D Validator()
config.validate(val, copy=3DTrue)
for key, value in config.iteritems():
# If marked as Immutable do not update item
if key not in config['immutable']:
config[key] =3D value #Update config with new value
val =3D Validator()
config.validate(val, copy=3DTrue)
return config
# Merge CLI options with config
def config_climerge(options, config):
cliconfig =3D vars(options) # CLI options
if options.overwrite: # If the overwrite flag is set CLI variables
have preferance
for key, value in cliconfig.iteritems():
if value: # Only add/overwrite config if option has a value
config[key] =3D value # Update config with new value
else: # Update config options unless immutable
for key, value in cliconfig.iteritems():
if key not in config['immutable'] and value: #if not immutable and
there is a value present
config[key] =3D value #Update config with new value
val =3D Validator()
config.validate(val, copy=3DTrue)
return config
###################################
# Importing configs
###################################
if os.path.exists(userconfigfile): # Import User config
config =3D config_usermerge(userconfigfile, config)
#Overwrite "config" with project config
if os.path.exists(projconfigfile): # Import project Config
config =3D config_projmerge(projconfigfile, config)
config =3D config_climerge(options, config) # Import CLI option
|
|
From: Michael F. <fuz...@vo...> - 2007-11-06 13:17:56
|
Jeffrey Barish wrote: > When I needed a way to specify configuration parameters for my program, I > chose ConfigObj without looking closely at ConfigParser very closely because > I had a feeling ConfigObj was better. Recently, I started using the logging > package with my software. It allows me to specify its configuration using a > configuration file, but it uses ConfigParser to access it. I would like to > keep all configuration data in one configuration file, so I figured that it > wouldn't be a big deal to switch my software over to ConfigParser. When I > first encountered get/set, my stomach twisted. When I discovered that I > couldn't specify a list as an option, I aborted. I was transforming code > that was simple and transparent into something verbose and opaque. Because > my configuration file is not compatible with ConfigParser, I am resigned to > two configuration files, one for my code and one for logging. However, I am > wondering first whether I am missing a one-configuration-file solution. I > suppose that logging needs to be updated to use ConfigObj, but perhaps I am > missing a solution that I can apply more readily. > I've not used the logging package - so I can't *really* comment. Is it not possible to swap out the configuration part of the logging package by supplying your config options programatically? That way you ccan write your own reading code that uses ConfigObj. Michael http://www.manning.com/foord |
|
From: Jeffrey B. <jef...@ea...> - 2007-11-06 02:25:45
|
When I needed a way to specify configuration parameters for my program, I chose ConfigObj without looking closely at ConfigParser very closely because I had a feeling ConfigObj was better. Recently, I started using the logging package with my software. It allows me to specify its configuration using a configuration file, but it uses ConfigParser to access it. I would like to keep all configuration data in one configuration file, so I figured that it wouldn't be a big deal to switch my software over to ConfigParser. When I first encountered get/set, my stomach twisted. When I discovered that I couldn't specify a list as an option, I aborted. I was transforming code that was simple and transparent into something verbose and opaque. Because my configuration file is not compatible with ConfigParser, I am resigned to two configuration files, one for my code and one for logging. However, I am wondering first whether I am missing a one-configuration-file solution. I suppose that logging needs to be updated to use ConfigObj, but perhaps I am missing a solution that I can apply more readily. -- Jeffrey Barish |
|
From: Michael F. <fuz...@vo...> - 2007-10-03 23:53:51
|
I've fixed the link on http://www.voidspace.org.uk/python/pythonutils.html My apologies. Pythonutils is difficult to get working with setuptools. I'll sort it one day. Michael Nicola Larosa wrote: > Forwarded to the development list. > > -------- Original Message -------- > Subject: Python Utils > Date: Wed, 3 Oct 2007 13:54:12 -0400 > From: Denney, William S. <wil...@me...> > To: ni...@te... > > Hello, > > Thanks for your work on pythonutils and the voidspace website. > > I was just trying to set it up on windows, and I found the following: > > * When I tried to install via easy_install, it downloaded version 0.2.3. > * When I tried to download it via > _http://www.voidspace.org.uk/python/pythonutils.html_ (the "Windows > Installer" link under Downloading) it downloaded version 0.2.5. > > Would it be possible to point both of these to > pythonutils-0.3.0.win32.exe.zip as it is on > _http://www.voidspace.org.uk/python/modules.shtml_? > > Thanks, > > Bill > > |
|
From: Michael F. <fuz...@vo...> - 2007-10-03 18:04:01
|
Thanks - and oops. Will sort. Michael http://www.manning.com/foord Nicola Larosa wrote: > Forwarded to the development list. > > -------- Original Message -------- > Subject: Python Utils > Date: Wed, 3 Oct 2007 13:54:12 -0400 > From: Denney, William S. <wil...@me...> > To: ni...@te... > > Hello, > > Thanks for your work on pythonutils and the voidspace website. > > I was just trying to set it up on windows, and I found the following: > > * When I tried to install via easy_install, it downloaded version 0.2.3. > * When I tried to download it via > _http://www.voidspace.org.uk/python/pythonutils.html_ (the "Windows > Installer" link under Downloading) it downloaded version 0.2.5. > > Would it be possible to point both of these to > pythonutils-0.3.0.win32.exe.zip as it is on > _http://www.voidspace.org.uk/python/modules.shtml_? > > Thanks, > > Bill > > |
|
From: Nicola L. <ni...@te...> - 2007-10-03 18:01:47
|
Forwarded to the development list. -------- Original Message -------- Subject: Python Utils Date: Wed, 3 Oct 2007 13:54:12 -0400 From: Denney, William S. <wil...@me...> To: ni...@te... Hello, Thanks for your work on pythonutils and the voidspace website. I was just trying to set it up on windows, and I found the following: * When I tried to install via easy_install, it downloaded version 0.2.3. * When I tried to download it via _http://www.voidspace.org.uk/python/pythonutils.html_ (the "Windows Installer" link under Downloading) it downloaded version 0.2.5. Would it be possible to point both of these to pythonutils-0.3.0.win32.exe.zip as it is on _http://www.voidspace.org.uk/python/modules.shtml_? Thanks, Bill -- Nicola Larosa - http://www.tekNico.net/ Most of our learned helplessness is illusory, and plays right into the hands of politicians, preachers, fearmongers, marketers and corporatists. -- Dave Pollard, May 2007 |
|
From: Michael F. <fuz...@vo...> - 2007-09-27 22:59:52
|
Stef Mientki wrote:
>>> Another question: is it possible to force the normal windows end-of-line
>>> (CR+LF),
>>> when writing to the config file ?
>>>
>>>
>>>
>> Hmmm... doesn't that happen automatically on Windows?
>>
>>
>>
> Hmm.. now you told me, it does indeed ???
> So I guess my observation was caused by a crash or error somewhere in my
> program.
>
>> ConfigObj does expose a 'newlines' attribute ('\r\n', '\n', or '\r'). It
>> does however go to great lengths to preserve line endings in a config
>> file it has read - or to use the native ones for the platform.
>>
>>
>>
> Great component,
> - my names in the name-value pairs keep their case
> - the order of the items in a section is preserved
>
> thanks very much Michael.
> I'll let you know when I release my program ( a hardware / software
> simulator for microcontrolers),
> so you can add it to the " Real World" chapter.
>
Cool - sounds great.
Michael
> cheers,
> Stef
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
>
|
|
From: Stef M. <s.m...@ru...> - 2007-09-27 22:34:36
|
>> Another question: is it possible to force the normal windows end-of-line
>> (CR+LF),
>> when writing to the config file ?
>>
>>
>
> Hmmm... doesn't that happen automatically on Windows?
>
>
Hmm.. now you told me, it does indeed ???
So I guess my observation was caused by a crash or error somewhere in my
program.
> ConfigObj does expose a 'newlines' attribute ('\r\n', '\n', or '\r'). It
> does however go to great lengths to preserve line endings in a config
> file it has read - or to use the native ones for the platform.
>
>
Great component,
- my names in the name-value pairs keep their case
- the order of the items in a section is preserved
thanks very much Michael.
I'll let you know when I release my program ( a hardware / software
simulator for microcontrolers),
so you can add it to the " Real World" chapter.
cheers,
Stef
|
|
From: Michael F. <fuz...@vo...> - 2007-09-27 21:38:49
|
Stef Mientki wrote:
>>>>
>>>>
>>>>
>>> Thanks that works ok.
>>> So why doesn't
>>> ini.list_values = False
>>> this work ?
>>>
>>>
>>>
>> Because by then ConfigObj has *already* read the values in. Changing the
>> settings afterwards only affects how they are written back out.
>>
>>
>>
> Thanks Michael, that explains.
>
> Another question: is it possible to force the normal windows end-of-line
> (CR+LF),
> when writing to the config file ?
>
Hmmm... doesn't that happen automatically on Windows?
ConfigObj does expose a 'newlines' attribute ('\r\n', '\n', or '\r'). It
does however go to great lengths to preserve line endings in a config
file it has read - or to use the native ones for the platform.
Michael
http://www.manning.com/foord
> cheers,
> Stef
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
>
|
|
From: Stef M. <s.m...@ru...> - 2007-09-27 20:02:23
|
>>> >>> >> Thanks that works ok. >> So why doesn't >> ini.list_values = False >> this work ? >> >> > > Because by then ConfigObj has *already* read the values in. Changing the > settings afterwards only affects how they are written back out. > > Thanks Michael, that explains. Another question: is it possible to force the normal windows end-of-line (CR+LF), when writing to the config file ? cheers, Stef |
|
From: Michael F. <fuz...@vo...> - 2007-09-26 22:34:28
|
Stef Mientki wrote: >> Shock horror - Python is *built* on dictionaries! :-) >> >> > Yes I read that before, > but doesn't mean that everyone is using them (explictly) ;-) > (I mainly do signal analysis and simulation) > >> >> >>> Still one other small question, which must be peanuts for you (and others), >>> how do I read a value as a normal string ? >>> When I've an inifile with following content: >>> size = (134,433) >>> ConfigObj gives me back a list >>> ['(134', '433)'] >>> >>> >>> >> By default ConfigObj treats comma separated values as lists. >> > Yes I read that ... > so I tried > ini.list_values = False > but that didn't work. > >> This *can* >> be inconvenient, so you can switch it off. >> >> >> ini = ConfigObj(filename, list_values=False) >> >> >> > Thanks that works ok. > So why doesn't > ini.list_values = False > this work ? > Because by then ConfigObj has *already* read the values in. Changing the settings afterwards only affects how they are written back out. Michael http://www.manning.com/foord > cheers, > Stef > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > > |
|
From: Stef M. <s.m...@ru...> - 2007-09-26 22:30:02
|
> Shock horror - Python is *built* on dictionaries! :-)
>
Yes I read that before,
but doesn't mean that everyone is using them (explictly) ;-)
(I mainly do signal analysis and simulation)
>
>> Still one other small question, which must be peanuts for you (and others),
>> how do I read a value as a normal string ?
>> When I've an inifile with following content:
>> size = (134,433)
>> ConfigObj gives me back a list
>> ['(134', '433)']
>>
>>
>
> By default ConfigObj treats comma separated values as lists.
Yes I read that ...
so I tried
ini.list_values = False
but that didn't work.
> This *can*
> be inconvenient, so you can switch it off.
>
>
> ini = ConfigObj(filename, list_values=False)
>
>
Thanks that works ok.
So why doesn't
ini.list_values = False
this work ?
cheers,
Stef
|
|
From: Michael F. <fuz...@vo...> - 2007-09-26 21:38:28
|
Stef Mientki wrote: >> ini[section_name].keys() >> >> > aha that's what I'm looking for. > >> ConfigObj has a 'dictionary interface' - so all the methods available on >> a normal Python dictionary can be used with ConfigObj. >> >> Simple enough? >> >> > Yes that's indeed not too difficult ;-) > the reason why I've so much trouble with this, > is probably that I (almost) never use dictionaries. > Shock horror - Python is *built* on dictionaries! :-) > Still one other small question, which must be peanuts for you (and others), > how do I read a value as a normal string ? > When I've an inifile with following content: > size = (134,433) > ConfigObj gives me back a list > ['(134', '433)'] > By default ConfigObj treats comma separated values as lists. This *can* be inconvenient, so you can switch it off. ini = ConfigObj(filename, list_values=False) HTH Michael Foord http://www.manning.com/foord > Undoubtedly usefull in most cases (although the brackets look weird to > me ;-), > but as I move around and manipulate these "things" all over in my program, > I just want to handle 1 type, for which I've chosen the string type. > > cheers, > Stef > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > > |
|
From: Stef M. <s.m...@ru...> - 2007-09-26 21:30:17
|
Michael Foord wrote: > Stef Mientki wrote: > >> [snip..] >> Now my problem is very-very simple, >> but I don't get it done, >> so maybe someone get give me a few simple ;-) hints. >> >> I open an ini-file for reading: >> ini = ConfigObj ( filename ) >> >> >> I want to see what sections are ther: >> ini.sections >> >> Now I want to see what keys are in 1 specific sections: >> ?????? >> things like >> ini.values() >> ini.items() >> >> > > thanks Michael, > ini.keys() > but that gives me the section names, so it's the same as ini.sections > or > > ini[section_name].keys() > aha that's what I'm looking for. > ConfigObj has a 'dictionary interface' - so all the methods available on > a normal Python dictionary can be used with ConfigObj. > > Simple enough? > Yes that's indeed not too difficult ;-) the reason why I've so much trouble with this, is probably that I (almost) never use dictionaries. Still one other small question, which must be peanuts for you (and others), how do I read a value as a normal string ? When I've an inifile with following content: size = (134,433) ConfigObj gives me back a list ['(134', '433)'] Undoubtedly usefull in most cases (although the brackets look weird to me ;-), but as I move around and manipulate these "things" all over in my program, I just want to handle 1 type, for which I've chosen the string type. cheers, Stef |
|
From: Michael F. <fuz...@vo...> - 2007-09-26 14:54:51
|
Stef Mientki wrote: > [snip..] > Now my problem is very-very simple, > but I don't get it done, > so maybe someone get give me a few simple ;-) hints. > > I open an ini-file for reading: > ini = ConfigObj ( filename ) > > > I want to see what sections are ther: > ini.sections > > Now I want to see what keys are in 1 specific sections: > ?????? > things like > ini.values() > ini.items() > ini.keys() or ini[section_name].keys() ConfigObj has a 'dictionary interface' - so all the methods available on a normal Python dictionary can be used with ConfigObj. Simple enough? HTH Michael http://www.manning.com/foord > give me all kind of key-value pairs, but without knowing in which > section they are stored ?? > > thanks, > Stef Mientki > > > > > > Het UMC St Radboud staat geregistreerd bij de Kamer van Koophandel in het handelsregister onder nummer 41055629. > The Radboud University Nijmegen Medical Centre is listed in the Commercial Register of the Chamber of Commerce under file number 41055629. > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > > |
|
From: Stef M. <S.M...@ru...> - 2007-09-26 14:37:39
|
hello,
Coming from windows/Delphi,
I've been using Python for half a year now.
For reading/writing windows ini-files,
I used ConfigParser (already much more difficult than Delphi ;-)
Now I needed an windows ini-file (not a registry file),
where the case of the keys was preserved
(ConfigParser makes all keys lowercase).
So someone advised me to use ConfigObj,
which should be superior to ConfigParser.
So I try to read the manual,
looks very nice and well written.
But when I read the introduction,
"*ConfigObj* is a simple but powerful config file reader and writer"
I miss the "simplicty".
Apparently this simplicity yields for a certain group of programmers,
probably coming from Linux / C,
certainly not for windows/Delphi programmers.
Now my problem is very-very simple,
but I don't get it done,
so maybe someone get give me a few simple ;-) hints.
I open an ini-file for reading:
ini = ConfigObj ( filename )
I want to see what sections are ther:
ini.sections
Now I want to see what keys are in 1 specific sections:
??????
things like
ini.values()
ini.items()
give me all kind of key-value pairs, but without knowing in which
section they are stored ??
thanks,
Stef Mientki
Het UMC St Radboud staat geregistreerd bij de Kamer van Koophandel in het handelsregister onder nummer 41055629.
The Radboud University Nijmegen Medical Centre is listed in the Commercial Register of the Chamber of Commerce under file number 41055629.
|