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
Configparser in AWS Glue is not reading config file from S3
I am trying to read a config file from S3 bucket via python script run by AWS glue. But the file is not read.
from __future__ import print_function
from pyspark import SparkContext
from awsglue.utils import getResolvedOptions
import sys
import…

mehere
- 1,487
- 5
- 28
- 50
0
votes
1 answer
Parsing multiple "key"="value" pairs in an INI section
I need pointers to parse an INI file using python 2.7 ConfigParser that looks like the following:
[google]
www.google.com domain_name=google location=external
[yahoo]
www.yahoo.com domain_name=yahoo location=external
This is what I have tried to…

new_c_user
- 123
- 2
- 12
0
votes
1 answer
Python project through cmd with different config files
i want to start my python project through a cmd window with different configurations, e.g the function that need different parameter:
download.rawData.download(starttime=starttime, endtime=endtime)
the starttime and endtime values are from a…

Thomas B
- 3
- 2
0
votes
0 answers
Hierarchical column labels SQL
I have data I am inserting into an SQL database from config files, structured like so:
[GROUP1]
Attribute1
Attribute2
[GROUP2]
Attribute3
Attribute4
I am new to SQL. Naively, each attribute can represent a column in my table, but I also want to…

user3180
- 1,369
- 1
- 21
- 38
0
votes
1 answer
How to load all variables from a configparser file?
I am trying to load all variables defined in a text file using configparser. I have managed to load them using a dictionary but I would like them to be loaded directly as variables. Is there a clean way to do…

j_bio
- 25
- 5
0
votes
1 answer
ConfigParser python 2.7. Delimiter is getting changed to '=' after config write
I have a file looks like below
[SectionOne]
Status: Single
Name: Derek
Value: Yes
Age: 30
Single: True
After i read and modify a field, the delimiter is getting changed to '=' instead of ':' as below
[SectionOne]
Status = Married
Name =…

Sagar
- 1,115
- 2
- 13
- 22
0
votes
2 answers
ConfigParser library not working when using with python3
I am using and importing ConfigParaser
import ConfigParser
config = ConfigParser.RawConfigParser()
config.read('Config.properties')
timeout_val=config.get('Section', 'commandtimeout')
and install it using,
pip install ConfigParser
While running…

Ammad
- 4,031
- 12
- 39
- 62
0
votes
1 answer
Python3 and ConfigParser returns unicode HTML characters differently
I have this ini file
[temp]
units = \u00b0 C
If I retrieve the value with ConfigParser, I get the following result
pi@pi-vm1:~ $ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits"…

wcndave
- 306
- 2
- 12
0
votes
0 answers
update particular option in section in ".ini" file using ConfigParser
I am trying to update a particular option in my config.ini file using ConfigParser.
This is my config.ini file:
[remote-server-details]
MACHINE_NAME = …

Ankur Sharma
- 45
- 3
- 10
0
votes
2 answers
Python smtplib and configparser as function
Hello I try to make a small monitoring, and in the monitoring.py, it should send a email with function sendmail.sende(). But i think, i got issues with variables. Could you give me some tips, what i do wrong please?
This is the sendmail.py
def…

Alhevi
- 5
- 2
0
votes
0 answers
Change config file in python without removing commentS
I have a simple config file like below and i wrote a quote to update the file.
cat /tmp/cfg
global key = value
section key = val
[section]
section key = val
[section2]
section key =10
My code works fine , but removes any comments i have in the…

pythonRcpp
- 2,042
- 6
- 26
- 48
0
votes
1 answer
Python,ConfigParser-Referencing in earlier directory
In my downloads folder, I have a folder called bin. Within the folder bin I have a file called config_template.ini, and another folder called SN. Within the folder SN I have a file called sample.py. In sample.py I use:
config =…

J.C
- 105
- 1
- 1
- 9
0
votes
1 answer
Building custom configuration parser to read method chaining style of configuration string
I am building a configuration parser where using regex I will read a string configuration in the form of
method chaining and
method calls as parameters inside another methods.
code that will read the configuration and prints them:-
r1 =…

dks551
- 1,113
- 1
- 15
- 39
0
votes
1 answer
How to run different code depends on the way python script is runned from the terminal or in an IDE?
Ok, so lets say I have this part of the code (it is not perfect). I want this scenario - I am detecting the cloud name ones as an argument in __init__ so all other modules and scripts will run on that cloud, or if I want to run the specific python…

Adiia
- 77
- 2
- 8
0
votes
0 answers
Is it possible to set colon(':') as the delimiter in a config file using python 2.7?
I am using Python 2.7.14 and I am trying to set a line in a config file with colon as a delimiter (for example- option : value) with ConfigParser. What I did is this:
import ConfigParser
config =…

Alexey Mishuk
- 1
- 1
- 1