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
2 answers
ConfigParser.get returning a string need to convert it to section
I want to use the return value of RawConfigParser.get ('somesection', 'someoption') as the section for another RawConfigParser.get, but in practice the result is a doubly encased string.
section = RawConfigParser.get ('somesection',…

user2994682
- 503
- 1
- 8
- 19
0
votes
2 answers
writing a subset of source ini file into destination ini file
I have source.ini as following
[section1]
name = 'xyz'
place = 'abc'
[section2]
....
....
[section3]
....
....
I want to read the source.ini and copy contents of only list of sections into a new ini file. Here's my code doing the needful..
import…

nick01
- 333
- 1
- 8
- 19
0
votes
2 answers
Python - update configparser between modules
I have terrible doubts regarding python config file approach.
I am creating a program with a GUI (PyQt). The program loads some settings from a .cfg file using the configparser module. And the user can edit these settings from the GUI with the user…

selfm
- 101
- 1
- 9
0
votes
2 answers
python configparser to parse the data saved in a text file
I have a text file called sampl1.txt. This is what is inside this text file:-
111
112
113
114
115
I have a .ini file called config_num.ini which contains:-
[num_group]
file = sample1.txt
Here is the code snippet:-
import ConfigParser
config =…

sam
- 127
- 3
- 13
0
votes
2 answers
How to access to the variables of the scope of a module called from the main module?
I need to access to the variables of the scope of a module imported in the main module from other module.
In my app, I've some modules in the same directory. One of these modules is a module that read a config_file.ini using configparser in order…

Trimax
- 2,413
- 7
- 35
- 59
0
votes
1 answer
using configparser in python class, good or bad?
Is it bad practice to use a ConfigParser within class methods? Doing this would mean the class is then tied to the config and not as easily re-usable, but means less input arguments in methods, which I would find messy especially if arguments had to…

Michael S
- 85
- 6
0
votes
1 answer
python ConfigParser module
I have the following ini file
[Section]
value=test
When i use the ConfigParser Module :
import ConfigParser
config = ConfigParser.ConfigParser()
config.read('config.ini')
str=config.get('Section', 'value')
if str == 'test':
print 1
else :
…

ron
- 281
- 2
- 3
- 9
0
votes
2 answers
ConfigParser writing double sections in output file
I'm using the ConfigParser module to write out a configuration file with server information that's being collected. The 1st section I'm writing is the local system information, but it seems to be writing the 1st section twice for some reason.
Here's…

WR7500
- 417
- 1
- 3
- 12
0
votes
0 answers
Python ConfigParser get list not string from dictionary
with python 2.7 and configparser module is it possible to get data in list format?
i.e
config = ConfigParser()
config.read( "BACK.ini") # read my input file
dizP=dict(config.items("sezione")) # assign data to dictionary
dizP…

user2239318
- 2,578
- 7
- 28
- 50
0
votes
1 answer
Parsing a Azure cloud services cscfg file using Powershell for Fluent Migrator
We have a number of Cloud Deployment projects for our Cloud Services. e.g.
\-Project.Cloud.UAT
\-ServiceConfiguration.Cloud.cscfg
\-ServiceDefinition.csdef
\-Project.Cloud.Production
\-ServiceConfiguration.Cloud.cscfg
…

Eoin Campbell
- 43,500
- 17
- 101
- 157
0
votes
1 answer
Using configparser and ftplib caused error
this code section in main() causes the problem:
config = configparser.ConfigParser()
config.read('config.ini')
ftp = ftplib.FTP("ftp.mommy.de")
username = config.get('Ftp','username')
print(username)
ftp.login(username,…

Benjamin Martin
- 576
- 1
- 8
- 27
0
votes
1 answer
ConfigParser changing more than expected when trying to merge sections
I had been tasked with writing a script that takes two ini files and merges them, one being the original and the second and more authoritative one being the change file. So basically anything that's new in the change file gets added, and anything…

c4ifford
- 11
- 2
0
votes
1 answer
Python ConfigParser to C++
I am working with a python program that outputs a file via ConfigParser. I am writing a program in c/c++ that needs access to these config files. Some of the options are multi-line so I can not simply scan the file for "x = y" and strip the "x = "…

uMinded
- 595
- 1
- 9
- 21
0
votes
1 answer
.Conf file manipulation from multiple python scripts
I'm using the ConfigParser module to read/write a .conf file from two Python scripts. One script is only reading data, while the other may also write to the .conf file. Considering this context is possible to end with corrupt data ? Or the…

steve
- 594
- 4
- 10
- 23
0
votes
2 answers
How to make Robot Framework functions accept arguments as strings instead of the default unicode type
I am writing a new RF library which are expected to take string arguments because the (pre-existing) Python library that I use is expecting strings, not unicode.
Ofcourse I can convert each unicode to string before calling my existing function which…

binithb
- 1,910
- 4
- 23
- 44