How to retrieve value from etc/sysconfig in Python
Posted
by stanleyxu2005
on Stack Overflow
See other posts from Stack Overflow
or by stanleyxu2005
Published on 2010-05-20T08:00:45Z
Indexed on
2010/05/20
8:30 UTC
Read the original article
Hit count: 306
Hi All,
I have a config file FOO in /etc/sysconfig/. This Linux file is very similar to INI-File, but without a section declaration.
In order to retrieve a value from this file, I used to write a shell script like:
source /etc/sysconfig/FOO
echo $MY_VALUE
Now I want to do the same thing in python. I tried to use ConfigParser, but ConfigParser does not accept such an INI-File similar format, unless it has a section declaration.
Is there any way to retrieve value from such a file?
© Stack Overflow or respective owner