[Python-Dev] ConfigParser with a single section

Guido van Rossum guido@python.org
Fri, 08 Nov 2002 08:24:28 -0500


> > However, in most cases, such files can be easily read with execfile,
> > passing an empty dictionary.
> 
> Unfortunately, variables without quotes is a common shell idiom:
> 
> >>> execfile("/etc/sysconfig/network-scripts/ifcfg-lo")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/etc/sysconfig/network-scripts/ifcfg-lo", line 2
>     IPADDR=127.0.0.1
>                  ^
> SyntaxError: invalid syntax
> 
> (no, I haven't tweaked the file just to show that.. :-)

Listen, these files are shell scripts.  Any attempts to parse them
with other means than feeding them to the shell are doomed.  Don't try
to tweak ConfigParser to do something it's not good at anyway.

--Guido van Rossum (home page: http://www.python.org/~guido/)