Questions tagged [configparser]

ConfigParser is a Python module for reading and writing configuration files that have a structure similar to those of INI files in Microsoft Windows.

683 questions
0
votes
1 answer

Read a non-conventional INI in python

I coding a script in python to read a .INI file. I know there is a library called configparser, but my .INI is a little different from the "standard". In general, the files should be like: [HEADER] username = john fruits = oranges, apples but in my…
0
votes
2 answers

separation of the string in .ini file (configparser)

My ConfigParser.ini file looks like: [Filenames] Table1={"logs.table2",92} Table2=("logs.table2",91) Table3=("audit.table3",34) Table4=("audit.table4",85) and now for example for Table1, I would like to get "logs.table2" value and 92 as separate…
bazyl
  • 263
  • 1
  • 7
  • 17
0
votes
2 answers

Trying to install pip error with configparser

I am trying to install pip and am getting some issues with configparser. Somehow the import configparser is pointing to the system version of python, python 2.7 instead of python 3.5 >> pip install -U pip Traceback (most recent call last): File…
praju05
  • 13
  • 4
0
votes
1 answer

Manipulate configuration files with ConfigParser lib on python

I have a conf file with several configurations, i need to parse the information automatically in order to create a interface for easy use. i give an example of one of my sections in configuration: [OutOfHoursAlert] comment_max_hour = Max…
Ricardo
  • 21
  • 4
0
votes
1 answer

Returning config.read() from function

I have a config.py which reads in multiple config files. from ConfigParser import * def zones_config(): zones_config = ConfigParser() zones = zones_config.sections() zones_config.read('zones.ini'), zones def settings_config(): …
JohnTaylor
  • 35
  • 6
0
votes
1 answer

TKinter User Input into OS Walk - Get user input to pull File Name

This is difficult to summarize what I am trying to do, I doubt the Title made it any easier to follow but... I am using tkinter to build an options dialog box, allowing the user to enter their own file name breakdown structure. Os.Walk would read…
sdavis891
  • 101
  • 1
  • 3
  • 10
0
votes
0 answers

Extra backslash gets added when reading a path

I am new to Python. I have the following config file test.conf path=Dtest.appender\=console Following is the python code in which I read a config from .conf file using ConfigParser from ConfigParser import SafeConfigParser def…
user3451476
  • 297
  • 1
  • 4
  • 17
0
votes
2 answers

Python 2.7 Linux \n to Windows \r\n

SOLUTION: Change ConfigParser.py Everything with \n should be \r\n, this way linux and windows can read the file with line return. This fixed it for us. I am writing an program in Linux and it communicates with an Windows 10 PC. I get an…
NLxDoDge
  • 189
  • 2
  • 13
0
votes
1 answer

What format should the file for ConfigParser be?

I'm setting up my credentials for the library: https://pypi.python.org/pypi/python-amazon-product-api/ Code for the relevant configparser on the project file here. I'm wondering, what format should the config file variables be? Should strings be…
User
  • 23,729
  • 38
  • 124
  • 207
0
votes
2 answers

Python ConfigParser persist configuration to file

I have a configuration file (feedbar.cfg), having the following content: [last_session] last_position_x=10 last_position_y=10 After I run the following python script: #!/usr/bin/env python import pygtk import gtk import ConfigParser import…
Andrei Ciobanu
  • 12,500
  • 24
  • 85
  • 118
0
votes
1 answer

ConfigParser and Scrapy: NoSectionError

I have a issue with my Scrapy crawler when I launch it. I used ConfigParser in order to have a small config.ini to set my table name which i create each time i launch the crawler to scrap. That a basic way to scrap but i'm still noob with scrapy…
Andronaute
  • 379
  • 3
  • 12
0
votes
2 answers

How do I procedurally assign more variables while the program is running?

I'm making a program that reads in data from a .ini file using configparser.py, so that I can create a Person object based on the information in the file. My .ini's look like this: [Pers1] name = Alice [Pers2] name = Bob ... [Pers25] name =…
Somatic
  • 193
  • 7
0
votes
1 answer

Python SafeConfigParser variable substitution, explanation of variable syntax?

I just started using Python's ConfigFile.SafeConfigParser class to parse a config file that contains variable definitions and references. It works nicely, but I can't find an explanation for the weird syntax for a variable reference: BASEPATH =…
Jonathan Sachs
  • 613
  • 8
  • 19
0
votes
1 answer

I do not understand how this Python code works - Unknown programming concept

My apologies for the crappy headline. If I were able to frame my problem properly I would have used google ;) I found an piece of python code able to parse ini files into a python dict called "store": #!/usr/bin/env python from ConfigParser import…
drscheme
  • 19
  • 1
  • 7
0
votes
1 answer

How to Print Unified Python Dictionary Within For Loop

I try to print one unified Python dictionary with the section's details from the Config.ini file but Unfortunately I get separate lists or only the final dict. I'd love to get some help from you guys. config_path = r"\Config.ini" dict =…
James
  • 875
  • 2
  • 15
  • 24