Questions tagged [ini]

The INI file format includes text-based initialization information for programs. Its structure is composed of "sections" and "properties".

INI is a file format for saving configurations. They are basic text files with a specified format. An INI file contains key/value pairs, which are divided into sections. For example, an INI file for a mobile phone OS could look like this.

[graphics]
login_screen=mountains
desktop_back=earth_from_space
look_and_feel=classic_layout

[securite]
enable_password = true
;should a password be required to unlock the phone
password_on_unlock = true 
password = AC4d201cxDAc30F5AC4d201cxDAc30F5

A section name is put between square brackets. Each line after the section title contains a key/value pair, separated by an equals sign (=). Lines starting with a semicolon are comments.

The INI file format is not well defined, many implementations handle INI files differently. Some ignore whitespaces in key or value names, while some don't. Some implementations allow for the number sign (#) for comments, while some others don't.

1656 questions
55
votes
10 answers

parsing .properties file in Python

The ConfigParser module raises an exception if one parses a simple Java-style .properties file, whose content is key-value pairs (i..e without INI-style section headers). Is there some workaround?
tshepang
  • 12,111
  • 21
  • 91
  • 136
53
votes
4 answers

browscap ini directive not set

I'm using the get_browser() function in an attempt to warn people that their browser doesn't support Javascript. Actually I'm using it to tell them they can use certain parts of a web application I'm building. I've decided to properly use Javascript…
Robert Hurst
  • 8,902
  • 5
  • 42
  • 66
48
votes
5 answers

Is it possible to add comments to eclipse.ini file

I wanted to comment some custom parameters I am using now, to remember why they are there the next time I edit it. But I cannot find any reference to comments in this file. Only this, but it is pretty old and hopefully there is a way to add comments…
Persimmonium
  • 15,593
  • 11
  • 47
  • 78
48
votes
8 answers

PHP ini file_get_contents external url

I use following PHP function: file_get_contents('http://example.com'); Whenever I do this on a certain server, the result is empty. When I do it anywhere else, the result is whatever the page's content may be. When I however, on the server where the…
arik
  • 28,170
  • 36
  • 100
  • 156
45
votes
3 answers

Is it possible to use inline comments for .ini files with PHP?

Is it possible and safe to use inline comments for .ini files with PHP? I prefer a system where the comments are inline with the variables, coming after them. Are the some gotchas concerning the syntax to be used?
vfclists
44
votes
9 answers

QSettings - where is the location of the ini file?

I'm using QSettings to store some data as ini file in Windows. I want to see the ini file, but I don't know what is the location of the ini file. This is my code: QSettings *set = new QSettings(QSettings::IniFormat, QSettings::UserScope, "bbb",…
dubila
  • 1,099
  • 2
  • 10
  • 11
43
votes
6 answers

create ini file, write values in PHP

I cannot find a way that easily lets me create a new file, treat it as an ini file (not php.ini or simiilar... a separate ini file for per user), and create/delete values using PHP. PHP seems to offer no easy way to create an ini file and…
netrox
  • 5,224
  • 14
  • 46
  • 60
36
votes
2 answers

How to set boolean values in an INI configuration file?

I've seen a variety of ways used to set boolean values in INI files: variable = true variable = 1 variable = on variable = yes Which is the most canonical, common, and/or preferred way?
Anirvan
  • 6,214
  • 5
  • 39
  • 53
34
votes
8 answers

Read all the contents in ini file into dictionary with Python

Normally, I code as follows for getting a particular item in a variable as follows try: config = ConfigParser.ConfigParser() config.read(self.iniPathName) except ConfigParser.MissingSectionHeaderError, e: raise…
prosseek
  • 182,215
  • 215
  • 566
  • 871
30
votes
6 answers

How to read and write to an ini file with PHP

I've been looking around the official php documentation but I'm unable to find what I'm looking for. http://php.net/manual/en/function.parse-ini-file.php I just want a function to edit and read the value from the php ini file, for…
Joricam
  • 2,329
  • 4
  • 18
  • 14
30
votes
9 answers

Windows batch script to read an .ini file

I'm trying to read an .ini file with the following format: [SectionName] total=4 [AnotherSectionName] total=7 [OtherSectionName] total=12 Basically I want to print out certain values from the .ini file, for example the total under OtherSectionName…
Hintswen
  • 3,987
  • 12
  • 40
  • 45
28
votes
5 answers

How to configure PIP per config file to use a proxy (with authentification)?

I used to set up environment evariables http_proxy and https_proxy (with user + password) in the past to use Pip (on Windows) behind a corporate proxy. But recently I needed to tell Pip to use a proxy without setting up environment variables as this…
Wlad
  • 2,866
  • 3
  • 28
  • 42
27
votes
5 answers

From where is my php.ini being loaded in php Docker container?

I am running this Docker instance of a linux debian:jessie with php 5.6. This is part of my phpinfo : As we can see the php.ini should be located at /usr/local/etc/php And this is what I have inside /usr/local/etc/ But there is no php.ini…
IgorAlves
  • 5,086
  • 10
  • 52
  • 83
26
votes
5 answers

Update INI file without removing comments

Consider the following INI file: [TestSettings] # First comment goes here environment = test [Browser] # Second comment goes here browser = chrome chromedriver = default ... I'm using Python 2.7 to update the ini file: config =…
sarbo
  • 1,661
  • 6
  • 21
  • 26
23
votes
4 answers

Change value in ini file using ConfigParser Python

So, I have this settings.ini : [SETTINGS] value = 1 And this python script from ConfigParser import SafeConfigParser parser = SafeConfigParser() parser.read('settings.ini') print parser.get('SETTINGS', 'value') As you can see, I want to read…
CarefullyAdvanced
  • 437
  • 1
  • 4
  • 15