|
From: Michael F. <fuz...@vo...> - 2006-03-06 23:35:52
|
Tjaart wrote: > > Hi Michael. > Hello Tjaart, I've copied this reply to the configobj-develop mailing list as it raises an important question about ConfigObj, Note that you didn't attach the config file, however your email has an important clue : > When I change the line which reads “bind =” to have a value then > everything’s fine, is this a bug or am I doing something wrong?. This is an 'empty value', which as far as I remember is part of the 'ini' file spec, but not currently legal syntax for ConfigObj. The correct way of specifying an empty value for ConfigObj is to do : bind = '' So it's not your inexperience - that part of the config file simply isn't legal syntax for ConfigObj at the moment. Nicola (ConfigObj co-developer) - the last three support queries I've had for ConfigObj have all been to do with empty values. It seems that a lot of people are using ConfigObj to parse ini files created elsewhere. IIRC the empty value *is* part of the normal ini spec. (A later version of ConfigObj 3 supported them.) Would you object to me extending ConfigObj to read empty values ? A logical counterpart to this is an additional option (default False) allowing you to specify that ConfigObj should write out empty values in place of the empty string. What do you think ? All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > I am working with the following file abc.conf included in my email, > when I open it with ConfigObj I get the following error. > > >>> config = ConfigObj("C:\Python24\abc.conf", configspec="abc.conf") > > Traceback (most recent call last): > > File "<stdin>", line 1, in ? > > File "C:\Python24\lib\site-packages\pythonutils\configobj.py", line > 1069, in _ > > _init__ > > self._handle_configspec(defaults['configspec']) > > File "C:\Python24\lib\site-packages\pythonutils\configobj.py", line > 1731, in _ > > handle_configspec > > raise ConfigspecError('Parsing configspec failed: %s' % e) > > configobj.ConfigspecError: Parsing configspec failed: Parse error in > value at li > > ne 19. > > >>> > > When I change the line which reads “bind =” to have a value then > everything’s fine, is this a bug or am I doing something wrong?. > > Sorry but I am very new to python can you maybe give me an example of > how to read the value(10) from line 12 which reads “myvalue = 10” > > I am really struggling with ConfigObj due to my lack of experience. > > Thanks for your help > > Regards Tjaart. > |