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

get key basis on value by reading property file in python?

I have a property file "holder.txt" like this which is in key=value format. Here key is clientId and value is hostname. p10=machineA.abc.host.com p11=machineB.pqr.host.com p12=machineC.abc.host.com p13=machineD.abc.host.com Now I want to read this…
flash
  • 1,455
  • 11
  • 61
  • 132
0
votes
1 answer

Configparser under Kivy

I have a problem deploying a Kivy application using configparser import kivy from kivy.app import App from kivy.uix.screenmanager import Screen import configparser class MainFrame(Screen): def __init__(self, **kwargs): super(MainFrame,…
Psionman
  • 3,084
  • 1
  • 32
  • 65
0
votes
1 answer

Unable to set a value for an option in a section in .ini file using ConfigParser using Python

I want to update the value of a particular option in a section in '.ini' file. I found that 'set' function can be used. Below is the code that I used. Here, set method is throwing an error "No Section". I tried all upper case and lower case also for…
0
votes
2 answers

ConfigParser breaking when section header itself has an ]

I am using the ConfigParser module like this: from ConfigParser import ConfigParser c = ConfigParser() c.read("pymzq.ini") However, the sections gets botched up like this: >>> c.sections() ['pyzmq:platform.architecture()[0'] for the pymzq.ini file…
Nishant
  • 20,354
  • 18
  • 69
  • 101
0
votes
1 answer

Python - ConfigParser - .ini file too large?

This is my first question on stackoverflow and I have only been involved with python for a short time, but I have a problem with reading an .ini file and I cannot find the answer anywhere. This is a small piece of my current code: import…
0
votes
1 answer

parsing registry text dumps into pandas

I have a registry text dump like below [HKLM\CurrentControlSet\somerandomthing] [HKLM\CurrentControlSet\somerandomthing\somerandomsub] "key1"=hex(7)"1234aa\ 123451234567788\ 124123412341234 …
johnnyb
  • 1,745
  • 3
  • 17
  • 47
0
votes
0 answers

Have Python's 'configparser' to treat lines under an ini section as (raw) lines?

Trying to make configparser treat lines under a section as raw text, and returning each line as items: Example config/ini file: [db] sqlite:///testing.db mysql:///user:pass@host/database The code i've currently got: config =…
DhP
  • 306
  • 1
  • 11
0
votes
2 answers

Python 2.7 import ConfigParser ModuleNotFoundError: No module named 'ConfigParser'

so lately i have a project to make a cryptocurrency trading bot using Python and then i stumble across Cointrader Library for Python, so i use that library for helping me build this project, the exchanger used here was Poloniex, so i added Poloniex…
Elan JM
  • 1
  • 1
  • 1
0
votes
1 answer

assign agrv[i] from lines in file using python

example input.dat [settings] port = 1234 host = abc.com How can I parse the file, and assign 1234 to agrv[1], abc.com to argv[2] and so on here is what i tried: $python p.py input.dat Traceback (most recent call last): File "p.py", line 8, in…
kamal
  • 9,637
  • 30
  • 101
  • 168
0
votes
2 answers

Python ConfigParser from file

I try to load config from file with read But when it reads from same folder it works When I read from parent it doesn’t. Code: / config.ini Conf/ __init__.py config.ini Conf.py // Conf.py config = ConfigParser() #this…
Tzook Bar Noy
  • 11,337
  • 14
  • 51
  • 82
0
votes
1 answer

No Section error of ConfigParser in Pyspark Cluster

I have a project in pyspark in with i implemented ConfigParser to load some settings from config.properties file. On local it work fine and without any issue so far... But on cluster it throws No section error. I Crawl internet and found some…
Jugraj Singh
  • 529
  • 1
  • 6
  • 22
0
votes
1 answer

When (and why) has been `__name__` magic variable removed from `ConfigParser` interpolation?

In Python 2.7 ConfigParser.ConfigParser interpolates pattern %(__name__)s as name of the section. In Python 3.6 (as well as 3.3) configparser.ConfigParser fails at the same interpolation with InterpolationMissingOptionError exception. When has the…
abukaj
  • 2,582
  • 1
  • 22
  • 45
0
votes
1 answer

"Extended" template-based INI file parsing in Python

I need to parse (and feed to a database) configuration files like this one (actually it is Asterisk's sip.conf): [client-template](!,natted-template) foo=foovalue moo=moovalue [client](client-template) bar=barvalue This syntax means that…
brownian
  • 435
  • 3
  • 13
0
votes
1 answer

Best way to import a configuration file which contains multiple sets of multiline data in Python?

I'm trying to import a file that has multiple variables within it, each variable containing anywhere from 1 entry to about a hundred. so something like this: [info] name = Jon number = 2 multiple_num = 5 2 4 65 78 45 I've formatted this as an .ini…
0
votes
1 answer

python how to pass section name in config parser as variable

******testfile.ini file******* **[TEST]** val1=1 val2=3 **[TEST1]** .. .. **[TEST2]** .. .. **[TEST3]** .. .. *****testprog.py**** #!/usr/bin/python import sys import ConfigParser import os section = sys.args[1] parser =…
Rahul Gupta
  • 201
  • 2
  • 4
  • 10