ConfigParser is a Python module for reading and writing configuration files that have a structure similar to those of INI files in Microsoft Windows.
Questions tagged [configparser]
683 questions
0
votes
1 answer
String to syntax Python
I use configparser to get values for my python script, but I need to call function stored in config.ini... Since all values in configparser are stored as strings, is it possible to transform string into syntax? If so, how?

Mirac7
- 1,566
- 4
- 26
- 44
0
votes
1 answer
Changing only one value in configparser Python 3
I have config.ini file that is edited by multiple Python scripts simultaneously and I am facing large issue here because when updating, some values get restored and it messes up everything...
I can't use
config.read("config.ini")
every time I need…

Mirac7
- 1,566
- 4
- 26
- 44
0
votes
3 answers
How to access the variables declared inside functions in python
I have the following code that reads the configuration file and stores the results in some variables as a list
import ConfigParser
def read_config_file():
config = ConfigParser.ConfigParser()
cnf_path = 'config_files/php.sr'
…

Shiva Krishna Bavandla
- 25,548
- 75
- 193
- 313
0
votes
3 answers
What is the best way to get values from a config file?
I have 15 values that I want to get from a config file and store them in separate variables.
I am using
from ConfigParser import SafeConfigParser
parser = SafeConfigParser()
parser.read(configFile)
and it is a really good library.
Option #1
If I…

Siecje
- 3,594
- 10
- 32
- 50
0
votes
3 answers
Problem configparser in python
Actually I am stuck in my work. I want to import a txt file into my python program which should have two lists of intergers.
The following program is working fine but I need to import the list 'a' and 'b' with the help of configparser.
It will be…

Gillani
- 119
- 1
- 1
- 5
0
votes
1 answer
How can I get the values of every item in a section?
I have a configuration file with one section, and multiple items with different values. I want to put all the values (not the variables) into a list. For example:
example.ini
[main]
apple: green
orange: orange
strawberry: red
banana:…

user1447941
- 3,675
- 10
- 29
- 34
0
votes
2 answers
Why does ConfigParser not write to disk immediately?
Given the following script:
import ConfigParser
from datetime import datetime
import time
def write_stuff():
section = "test"
item = "oh hey there"
conf_filename = "test.conf"
conf = ConfigParser.ConfigParser()
…

Alexi Kostibas
- 51
- 1
- 6
0
votes
1 answer
Extending the configparser class and using a config parser in new class
So I am trying to create a class that will have already read in the file and have all functions of configparser plus a few more.
Code looks like this:
import configparser
class dkconfig(configparser):
def __init__(self):
self.clusterini…

beeryardtech
- 605
- 1
- 4
- 15
0
votes
1 answer
Delete Sections and Keys from INI file Using Python Module iniparse?
I'm using the Python module iniparse to save keys to an INI file, but I was wondering if there is a way to delete keys and sections from the INI file using iniparse. I know it's possible using ConfigParser and that iniparse is backwards compatible…

nicholaswilde
- 101
- 3
- 10
0
votes
1 answer
python configparser hangs silently
I have a feeling I'm being stupid. Given this ini file:
[main]
source1 = ./testing/sdir1
sync1 = ./testing/sydir1
archive1 = ./testing/adir1
source2 = ./testing/sdir2
sync2 = ./testing/sydir2
archive2 = ./testing/adir2
[logging]
log_dir =…

Jason
- 33
- 4
-1
votes
1 answer
Python Script runs fine on RPi until I try creating shortcut - ConfigParser throws "no section" error
I have a functioning python script that runs fine when I call it via terminal or any Python editor. But when I create a shortcut or bash to open the file it makes it part way through the code until it comes across ConfigParser which is of course…

ryan jones
- 9
- 2
-1
votes
1 answer
Python configparser remote file in Gitlab
I have requirement to refactor a K8s Python app so that it gets some configuration from a remote Giltab project because for various reasons we want to decouple applicaton settings from our pipeline/deployment environment.
In my functional testing,…

Robert Campbell
- 303
- 3
- 12
-1
votes
1 answer
Parse .conf file using python
I have a file called clients.conf .
Here is its content :
client: {
# client data
name: "James"
information: {
age: "32"
adress: "258 Arthur Street"
}
email: jamesbryan@yyyy.com
certification: {
…

Nab
- 133
- 1
- 8
-1
votes
2 answers
Tkinter and ConfigParser
I am writing a small program where there are two entry widgets that load the path from the configuration file.Is it possible to insert a value into each entry widget (values in the config are in order)?I only managed to insert values into one…

ChainSaw
- 29
- 6
-1
votes
1 answer
how to match a multiline section in a file and delete it using regex in Python?
I have an INI file with sections mentioned within [ ] and variables in a key = value manner.
In it, I have a section called [FILES] which only has some file (with .ini extension) paths mentioned under it without any key-value pair.
Using…

A.G.Progm.Enthusiast
- 846
- 14
- 29