Questions tagged [configobj]

ConfigObj is a python module for configuration file reading, writing and validation, with validation being the primary feature that distinguishes it from the built-in configparser module.

configobj is a Python module to easily write values to a file and read them back later for use. The common imports are from configobj import ConfigObj and import configobj.

51 questions
2
votes
1 answer

Python 3.3 install "configobj"

could somebody walk me through installing the python configobj module? I downloaded it from here but it throws an error during installation except Exception, e: ^ SyntaxError: invalid syntax I have Python 3.3.2 installed and the…
Andrei Stalbe
  • 1,511
  • 6
  • 26
  • 44
2
votes
0 answers

ConfigObj validator adds section from cs to config

I have a problem with python configobj. Why is "parameter" (named parameter) from cs added to config during config.validate(validator, preserve_errors=True)? def test_MissingSectionError(self): cfg = ''' [general] name =…
2
votes
6 answers

Make python configobj to not put a space before and after the '='

Simple question. It is possible to make configobj to not put a space before and after the '=' in a configuration entry ? I'm using configobj to read and write a file that is later processed by a bash script, so putting an antry like: VARIABLE =…
Juancho
  • 629
  • 7
  • 17
2
votes
2 answers

Installing configobj for python 2.7

I'm sorry, I'm a Python scrub and I just wanted to make sure that I'm installing this library the right way. I'm trying to get configObj installed for Python 2.7 Should I just browse to the directory the unzip is in and python.exe setup.py? If I do…
El Duderino
  • 499
  • 2
  • 4
  • 15
1
vote
1 answer

ConfigObj long lists and default values

I have a couple of questions about configobj, which I'm happily trying to use for this project. The first question is, how do I make a very long list of things? Suppose I have declared in a spec file. val = string_list now I would like to do val…
andrea_crotti
  • 3,004
  • 2
  • 28
  • 33
1
vote
1 answer

Extending configobj on python to handle custom comment marker

I have a config file, key and value pairs without sections. I'm trying to use configobj to parse it, but comments on my config files start with // rather than # In the configobj documentation I found an example but it doesn't work to me: from…
carduque
  • 188
  • 1
  • 14
1
vote
1 answer

using configobj to read a complete section one by one

I am using configobj to read a config file as below. [default] PROP1 = "12345" PROP2 = "abcde" [section1] PROP1 = "56789" PROP2 = "" [section2] PROP1 = "" PROP2 = "" I aim to read the list of sections first and then get…
Umapathy
  • 772
  • 8
  • 21
1
vote
1 answer

How to append to existing config file using ConfigObj?

I am attempting to use ConfigObj to write to a config file with a function. #!/usr/bin/evn python3.5 import configobj def createConfig(path): config = configobj.ConfigObj() config.filename = path config[REFNAME] = {} …
wilbo
  • 21
  • 5
1
vote
0 answers

Configspec in string ConfigObj

I have read that you can pass the configspec as a string and not as a file for the ConfigObj module. The question more than anything is how is the right way? Because I made several attempts, but they are wrong, for sure because I did not understand.…
BlackFenix06
  • 577
  • 1
  • 6
  • 22
1
vote
2 answers

ImportError: No module named configobj

I created .exe file using pyinstaller 3.3.1 and I got this message Traceback (most recent call last): File "install.py", line 14, in ImportError: No module named configobj [8468] Failed to execute script install I'm working with python 2.7…
YoavShe
  • 151
  • 2
  • 3
  • 11
1
vote
1 answer

String interpolation using variables of other subsections

I've been always using ConfigParser. Now that I have the need of using nested sections, I've found ConfigObj which seems to fit really my needs. The problem comes when I try to interpolate variables from other subsections. Is this possible?…
Pau RS
  • 86
  • 6
1
vote
1 answer

Troublesome DAT editing with Python 2.7 and ConfObj/Parser

Edit - final open source code here if interested. https://github.com/qetennyson/ConfigFileBuilder Hi there, first question here. I'm relatively new to Python (using 2.7 here) and have always been a pretty average programmer as it is. I'm working…
1
vote
3 answers

How to create a list of lists in the config, while using ConfigObj in Python?

I am using ConfigObj in Python to read from my config file. I need to read a list of lists from the config file. Here's what I've tried so far: sections and subsections - creates dictionaries, not lists list_of_lists = (1, 2, (3, 4)) - ConfigObj…
th3an0maly
  • 3,360
  • 8
  • 33
  • 54
1
vote
0 answers

ConfigObject nested section without any parent setting

I am using http://www.voidspace.org.uk/python/configobj.html to parse my configuration and it looks like it doesnt allow you to do this: [section 1] [[sub-section 1]] # this is in section 1 keyword1 = value1 keyword2 = value2 …
lapinkoira
  • 8,320
  • 9
  • 51
  • 94
1
vote
1 answer

Mocking ConfigObj instances

Using ConfigObj, I want to test some section creation code: def create_section(config, section): config.reload() if section not in config: config[session] = {} logging.info("Created new section %s.", section) else: …
Sardathrion - against SE abuse
  • 17,269
  • 27
  • 101
  • 156