|
From: David H. <neg...@gm...> - 2011-02-24 14:12:58
|
For starters, make sure you're actually referring to the config.ini
file that you think you are, and that it contains what you intend it
to contain.
The one you provided doesn't even parse correctly because it's got
'soc_source' listed as a keyword twice. So the example code you have
doesn't even match the example file, since the following line would
throw an exception:
> config = ConfigObj('c:\temp\config.ini')
Which leads me to suspect that perhaps the config.ini file that you're
actually loading does NOT, in fact, have the following line in it:
> som_somserver = 1
Which would explain the KeyError.
cheers,
-hoss
On Thu, Feb 24, 2011 at 08:50, Anton Hughes <kur...@gm...> wrote:
> Hi
> Im trying to use ConfigObj but am getting the following error. And I have
> know idea what I am doing wrong. Anyone can help?
>
> from configobj import ConfigObj
> config = ConfigObj('c:\temp\config.ini')
> config["som_somserver"]
> Traceback (most recent call last):
> File "<console>", line 1, in <module>
> File "build\bdist.win32\egg\configobj.py", line 567, in __getitem__
> val = dict.__getitem__(self, key)
> KeyError: 'som_somserver'
>
>
> Here is a copy of my config file:
> soc_source = soc_source
> retail_price = $400
> soc_source = 1
> soc_theme = 2
> soc_target = 3
> soc_folder_exist = 4
> soc_folder_temp_exist = 5
> soc_folder_backup_exist = 6
> som_somserver = 1
> som_filename=2
> som_sourcefile = 3
> som_targetfile = 4
> som_fileexist = 5
> som_file_temp_exist=6
> som_file_backup_exist=7
> Thanks
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT
> data
> generated by your applications, servers and devices whether physical,
> virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
>
|