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 Is Pulling in an Old File
I'm trying to write unit tests for a file that use ConfigParser to read in a properties but for some reason it's pulling in an outdated file that's no longer on my filesystem (at least that I can find). This was introduced when I pulled in a git…

Adam Scharf
- 11
- 3
0
votes
1 answer
How to pass variable values to another config parameters?
[plugin_jira]
maxuser=
finduser=
endpoint="https://nepallink.atlassian.net/rest/api/latest/user/search?startAt=0&maxResults={maxi}&username={manche}%".format(maxi=maxresult,manche=user_find)
This is my config file , in the endpoints item why I am…

Tara Prasad Gurung
- 3,422
- 6
- 38
- 76
0
votes
2 answers
Using ConfigParser to read non-standard config files
I am having a config file of the form
# foo.conf
[section1]
foo=bar
buzz=123
[section2]
line1
line2
line3
that I want to parse using the Python ConfigParser library. Note that section2 does not contain key/value pairs but some raw text instead. I…

Simon Fromme
- 3,104
- 18
- 30
0
votes
0 answers
ConfigParser giving error
I am using config parser to read an item tasks or Tasks from an INI file. The problem with the code is, it is checking for the case of Item. but in my case the item can be having case.
config file:
[tasks]
;Order of the tasks is…

sunil
- 17
- 3
0
votes
1 answer
Using ConfigParser in Python - tests OK but wipes file once deployed
I am running my own pool control system and I wanted to implement copying certain system parameters to a flat file for processing by a web interface I am working on. Since there are just a few entries I liked ConfigParser for the job.
I built a…

Richard
- 313
- 1
- 4
- 14
0
votes
1 answer
configparser in Tkinter - make new ini file with id?
i have made a simple GUI app, with tkinter and configparser, to store the values in my entry/text fields.
But i need help with something. I want to make the pogram assign a new ini file every time the user saves the input from the button and give…

Martin Led
- 65
- 2
- 2
- 9
0
votes
1 answer
Multilevel dictionary to ini
How to convert multilevel(*) dictionary to ini?
Example:
>>> foo = {}
>>> foo['bar'] = {}
>>> foo['bar']['bar1'] = 1
>>> foo['bar']['bar2'] = {}
>>> foo['bar']['bar2']['bar3'] = 2
>>> foo['goo'] = {}
>>> print foo
{'goo': {}, 'bar': {'bar1': 1,…

Michal
- 2,078
- 19
- 29
0
votes
1 answer
Special character '/' in ConfigParser Python
I've encountered the following problem using the ConfigParser in Python 2.6. I have the string 'A End NE Frame/shelf' as a header of a column in a .csv file and I'm receiving the following error when I try to run the code:
ValueError: field named…

Razvan Matei
- 11
- 2
0
votes
1 answer
How to create configuration file in Python where need to have os.path.join?
I have a couple of Python modules, something like:
prepare_data.py
process_data.py
generate_report.py
I take an Excel file, process it and then create a .pdf report. It's very linear, procedural programming. In a main caller.py module, I call the…

Alex Tereshenkov
- 3,340
- 8
- 36
- 61
0
votes
1 answer
Changes not written to file correctly in Python 2.7
For a few days now, I have been struggling with a problem, namely that the settings written by my settings class for a parser are not persistent when the program gets restarted. This problem occurs only on Windows, but in both Python x86 and x64…

RedFantom
- 332
- 1
- 10
0
votes
2 answers
Configparser in Python does't return all sections with the same name
My ini file:
[1]
[4]
[5]
[6]
[9]
[1]
[1]
My python Script
import configparser
config = configparser.ConfigParser()
config.readfp(open('inifile.ini'))
print config.sections()
>>> ['1', '4', '5', '6', '9'] #where are two more '1' ?
How to get…
user6565581
0
votes
1 answer
Impossible to create a configuration file for an python application inside Google App Engine
I try to create a configuration file, where I can store constants.
Whenever I try with ConfigParser, I get an error
Traceback (most recent call last):
File "/home/baun/google_appengine/google/appengine/ext/webapp /__init__.py", line 511,…

Neverland
- 773
- 2
- 8
- 24
0
votes
2 answers
How in python's module CONFIGPARSER read text from variable, not from a file?
The problem is that config.read("filename.ini") - requires a local file. I download the content of this file straight into the variable from my FTP server with the help of StringIO.
content = StringIO()
f.retrbinary('RETR /folder1/inifile.ini,…
user6565581
0
votes
1 answer
How to use ConfigParser with virtualenv?
I wrote a tool that looks in several places for an INI config file: in /usr/share, /usr/local/share, ~/.local/share, and in the current directory.
c = ConfigParser.RawConfigParser()
filenames = ['/usr/share/myconfig.conf',
…

Nathan Farrington
- 1,890
- 1
- 17
- 27
0
votes
1 answer
Python configparser reading section and creating new config
I'm currently reading a config file getting all values from a specific section and printing them however, instead of printing them I would like to create a new config file with just that section I am reading.
How would I go about…

Ranga Sarin
- 169
- 1
- 5
- 14