1974
Many config files from other applications allow empty values. As of version
1975
4.3.0, ConfigObj will read these as an empty string.
1977
A new option/attribute has been added (``write_empty_values``) to allow
1978
ConfigObj to write empty strings as empty values.
1983
from configobj import ConfigObj
1988
config = ConfigObj(cfg)
1990
ConfigObj({'key': '', 'key2': ''})
1992
config.write_empty_values = True
1993
for line in config.write():
2004
The ``unrepr`` option allows you to store and retrieve the basic Python
2005
data-types using config files. It has to use a slightly different syntax to
2006
normal ConfigObj files. Unsurprisingly it uses Python syntax.
2008
This means that lists are different (they are surrounded by square brackets),
2009
and strings *must* be quoted.
2011
The types that ``unrepr`` can work with are :
2013
| strings, lists tuples
2015
| dictionaries, integers, floats
2016
| longs and complex numbers
2018
You can't store classes, types or instances.
2020
``unrepr`` uses ``repr(object)`` to write out values, so it currently *doesn't*
2021
check that you are writing valid objects. If you attempt to read an unsupported
2022
value, ConfigObj will raise a ``configobj.UnknownType`` exception.
2024
Values that are triple quoted cased. The triple quotes are removed *before*
2025
converting. This means that you can use triple quotes to write dictionaries
2026
over several lines in your config files. They won't be written like this
2029
If you are writing config files by hand, for use with ``unrepr``, you should
2030
be aware of the following differences from normal ConfigObj syntax :
2032
| List : ``['A List', 'With', 'Strings']``
2033
| Strings : ``"Must be quoted."``
2034
| Backslash : ``"The backslash must be escaped \\"``
2036
These all follow normal Python syntax.
2038
In unrepr mode *inline comments* are not saved. This is because lines are
2039
parsed using the `compiler package <http://docs.python.org/lib/compiler.html>`_
2040
which discards comments.
2043
String Interpolation
2044
====================
1410
2046
ConfigObj allows string interpolation *similar* to the way ``ConfigParser``
1412
You specify a value to be substituted by including ``%(name)s`` in the value.
1414
Interpolation checks first the 'DEFAULT' sub-section of the current section to
1415
see if ``name`` is the key to a value. ('name' is case sensitive).
1417
If it doesn't find it, next it checks the 'DEFAULT' section of the parent
1418
section, last it checks the 'DEFAULT' section of the main section.
1420
If the value specified isn't found then a ``MissingInterpolationOption`` error
1421
is raised (a subclass of ``ConfigObjError``).
2047
or ``string.Template`` work. The value of the ``interpolation`` attribute
2048
determines which style of interpolation you want to use. Valid values are
2049
"ConfigParser" or "Template" (case-insensitive, so "configparser" and
2050
"template" will also work). For backwards compatibility reasons, the value
2051
``True`` is also a valid value for the ``interpolation`` attribute, and
2052
will select ``ConfigParser``-style interpolation. At some undetermined point
2053
in the future, that default *may* change to ``Template``-style interpolation.
2055
For ``ConfigParser``-style interpolation, you specify a value to be
2056
substituted by including ``%(name)s`` in the value.
2058
For ``Template``-style interpolation, you specify a value to be substituted
2059
by including ``${cl}name{cr}`` in the value. Alternately, if 'name' is a valid
2060
Python identifier (i.e., is composed of nothing but alphanumeric characters,
2061
plus the underscore character), then the braces are optional and the value
2062
can be written as ``$name``.
2064
Note that ``ConfigParser``-style interpolation and ``Template``-style
2065
interpolation are mutually exclusive; you cannot have a configuration file
2066
that's a mix of one or the other. Pick one and stick to it. ``Template``-style
2067
interpolation is simpler to read and write by hand, and is recommended if
2068
you don't have a particular reason to use ``ConfigParser``-style.
2070
Interpolation checks first the current section to see if ``name`` is the key
2071
to a value. ('name' is case sensitive).
2073
If it doesn't find it, next it checks the 'DEFAULT' sub-section of the current
2076
If it still doesn't find it, it moves on to check the parent section and the
2077
parent section's 'DEFAULT' subsection, and so on all the way up to the main
2080
If the value specified isn't found in any of these locations, then a
2081
``MissingInterpolationOption`` error is raised (a subclass of
2082
``ConfigObjError``).
1423
2084
If it is found then the returned value is also checked for substitutions. This
1424
2085
allows you to make up compound values (for example directory paths) that use
1425
2086
more than one default value. It also means it's possible to create circular
1426
references. If after ten replacements there are still values to substitute, an
1427
``InterpolationDepthError`` is raised.
2087
references. If there are any circular references which would cause an infinite
2088
interpolation loop, an ``InterpolationLoopError`` is raised.
1429
2090
Both of these errors are subclasses of ``InterpolationError``, which is a
1430
2091
subclass of ``ConfigObjError``.
1460
2122
These comments are all written back out by the ``write`` method.
1465
ConfigObj 4 is designed to work with ASCII compatible encodings [#]_. If you
1466
need support for other character sets, then I suggest you use the UTF8
1467
encoding for your config files.
1469
By default ConfigObj leaves keys/members as encoded byte strings (ordinary
1470
strings). If you want to access the config file members as Unicode objects
1471
rather than strings, you can use the ``decode`` method. This takes an encoding
1472
as its argument and decodes all members and keys into Unicode. It will only
1473
work if *all* members are byte strings (or lists of strings) , so you should do
1474
it before calling ``validate``.
1476
If you want to turn the Unicode strings back into byte strings, you can call
1477
the ``encode`` method. This also takes an encoding as its argument and assumes
1478
*all* keys/members are Unicode.
1480
If you start working with Unicode strings, you may find you get
1481
``UnicodeDecodeError`` or ``UnicodeEncodeError`` in unexpected places. This is
1482
because you have forced Python to do an *implicit* encode or decode.
1484
Implicit decodes (and encodes) use the encoding returned by
1485
``sys.getdefaultencoding()``. This is *usually* ASCII. This means that if you
1486
have any non-ASCII characters, Python doesn't know how to treat them and will
1489
This happens if you add a byte string to a Unicode string, compare a byte
1490
string to a Unicode string, print a Unicode string, or write it to a file. If
1491
you work with Unicode, you should do the appropriate encode or decode first.
1493
Backwards Compatibility
1494
=======================
1496
There have been a lot of changes since ConfigObj 3. The core parser is now
1497
based on regular expressions, and is a lot faster and smaller. There is now no
1498
difference in the way we treat flat files and non-flatfiles, that is, no empty
1499
sections. This means some of the code can be a lot simpler, less code does
1500
more of the work [#]_.
1502
There have been other simplifications: for example we only have eight options
1503
instead of seventeen.
1505
Most config files created for ConfigObj 3 will be read with no changes and many
1506
programs will work without having to alter code. Some of the changes do break
1507
backwards compatibility: for example, code that uses the previous options will
1508
now raise an error. It should be very easy to fix these, though.
1510
Below is a list of all the changes that affect backwards compatibility. This
1511
doesn't include details of method signatures that have changed, because almost
1514
Incompatible Changes
1515
--------------------
1517
(I have removed a lot of needless complications: this list is probably not
1518
conclusive, many option/attribute/method names have changed.)
1522
The only valid divider is '='.
1524
Line continuations with ``\`` removed.
1526
No recursive lists in values.
1530
No distinction between flatfiles and non flatfiles.
1532
Change in list syntax: use commas to indicate list, not parentheses (square
1533
brackets and parentheses are no longer recognised as lists).
1535
';' is no longer valid for comments, and no multiline comments.
1537
No attribute-style access to values.
1539
Empty values not allowed: use '' or "".
1541
In ConfigObj 3, setting a non-flatfile member to ``None`` would initialise it
1542
as an empty section.
1544
The escape entities '&mjf-lf;' and '&mjf-quot;' have gone, replaced by triple
1545
quote, multiple line values.
1547
The ``newline``, ``force_return``, and ``default`` options have gone.
1549
The ``encoding`` and ``backup_encoding`` methods have gone, replaced with the
1550
``encode`` and ``decode`` methods.
1552
``fileerror`` and ``createempty`` options have become ``file_error`` and
1555
Partial configspecs (for specifying the order members should be written out,
1556
and which should be present) have gone. The configspec is no longer used to
1557
specify order for the ``write`` method.
1559
Exceeding the maximum depth of recursion in string interpolation now raises an
1560
error ``InterpolationDepthError``.
1562
Specifying a value for interpolation which doesn't exist now raises a
1563
``MissingInterpolationOption`` error (instead of merely being ignored).
1565
The ``writein`` method has been removed.
1567
The comments attribute is now a list (``inline_comments`` equates to the old
1568
comments attribute).
2130
flatten_errors(cfg, res)
2132
Validation_ is a powerful way of checking that the values supplied by the user
2135
The validate_ method returns a results dictionary that represents pass or fail
2136
for each value. This doesn't give you any information about *why* the check
2139
``flatten_errors`` is an example function that turns a results dictionary into
2140
a flat list, that only contains values that *failed*.
2142
``cfg`` is the ConfigObj instance being checked, ``res`` is the results
2143
dictionary returned by ``validate``.
2145
It returns a list of keys that failed. Each member of the list is a tuple : ::
2147
([list of sections...], key, result)
2149
If ``validate`` was called with ``preserve_errors=False`` (the default)
2150
then ``result`` will always be ``False``.
2152
*list of sections* is a flattened list of sections that the key was found
2155
If the section was missing then key will be ``None``.
2157
If the value (or section) was missing then ``result`` will be ``False``.
2159
If ``validate`` was called with ``preserve_errors=True`` and a value
2160
was present, but failed the check, then ``result`` will be the exception
2161
object returned. You can use this as a string that describes the failure.
2165
*The value "3" is of the wrong type*.
2171
The output from ``flatten_errors`` is a list of tuples.
2173
Here is an example of how you could present this information to the user.
2179
vtor = validate.Validator()
2180
# ini is your config file - cs is the configspec
2181
cfg = ConfigObj(ini, configspec=cs)
2182
res = cfg.validate(vtor, preserve_errors=True)
2183
for entry in flatten_errors(cfg, res):
2184
# each entry is a tuple
2185
section_list, key, error = entry
2187
section_list.append(key)
2189
section_list.append('[missing section]')
2190
section_string = ', '.join(section_list)
2192
error = 'Missing value or section.'
2193
print section_string, ' = ', error
1573
2201
ConfigObj 3 is now deprecated in favour of ConfigObj 4. I can fix bugs in
1574
2202
ConfigObj 3 if needed, though.
1637
2267
You should also be able to find a copy of this license at : `BSD License`_
1639
.. _BSD License: http://www.voidspace.org.uk/documents/BSD-LICENSE.txt
2269
.. _BSD License: http://www.voidspace.org.uk/python/license.shtml
1644
Fix any bugs (and resolvable issues).
1646
Do an example for the 'walk' which removes uniform indentation in multiline
1649
When initialising a section from a ConfigObj *or* an ``OrderedDictionary``
1650
we could preserve ordering.
1652
Add an *odict* method which returns an `OrderedDictionary``.
2275
Better support for configuration from multiple files, including tracking
2276
*where* the original file came from and writing changes to the correct
2279
Make ``newline`` an option (as well as an attribute) ?
2281
``UTF16`` encoded files, when returned as a list of lines, will have the
2282
BOM at the start of every line. Should this be removed from all but the
2285
Option to set warning type for unicode decode ? (Defaults to strict).
2287
A method to optionally remove uniform indentation from multiline values.
2288
(do as an example of using ``walk`` - along with string-escape)
2290
Should the results dictionary from validate be an ordered dictionary if
2291
`odict <http://www.voidspace.org.uk/python/odict.html>`_ is available ?
2293
Implement some of the sequence methods (which include slicing) from the
2296
Preserve line numbers of values (and possibly the original text of each value).
1659
Please file any bug reports to `Michael Foord`_ or the ConfigObj
2304
Please file any bug reports to `Michael Foord`_ or the **ConfigObj**
1660
2305
`Mailing List`_.
1662
You can't have a keyword with the same name as a section (in the same section).
1663
They are both dictionary keys, so they would overlap.
1665
Interpolation checks first the 'DEFAULT' sub-section of the current section,
1666
next it checks the 'DEFAULT' section of the parent section, last it checks the
1667
'DEFAULT' section of the main section.
1669
Logically a 'DEFAULT' section should apply to all subsections of the *same
1670
parent*: this means that checking the 'DEFAULT' sub-section in the *current
1671
section* is not necessarily logical ?
1673
In order to simplify Unicode support (which is possibly of limited value
1674
in a config file ?) I have removed automatic support, and added thev``encode``
1675
and ``decode`` methods. These can be used to transform keys and entries.
1676
Because the regex looks for specific values on inital parsing (i.e. the quotes
1677
and the equals signs) it can only read ASCII compatible encodings. For Unicode
1678
I suggest ``UTF8``, which is ASCII compatible.
1682
There is no reason why you shouldn't decode your config file into Unicode
1683
before passing them to ConfigObj (as a list of lines). This should give you
1684
Unicode keys and values.
1686
Does it matter that we don't support the ':' divider, which is supported by
1689
Following error with "list_values=False" : ::
1691
>>> a = ["a='hello', 'goodbye'"]
1693
>>> c(a, list_values=False)
1694
{'a': "hello', 'goodbye"}
1696
The regular expression correctly removes the value - ``"'hello', 'goodbye'"`` -
1697
and then unquote just removes the front and back quotes (called by
1698
``_handle_value``). What should we do ?? We *ought* to raise an exception -
1699
because if lists are off it's an invalid value. This is not desired if you want
1700
to do your own list processing e.g. using listquote for nested lists. It would
1701
be *better* in this case not to unquote. Raising an exception would require a
1704
String interpolation and validation don't play well together. See
1705
`Validation and Interpolation`_.
2307
There is currently no way to specify the encoding of a configspec file.
2309
When using ``copy`` mode for validation, it won't copy ``DEFAULT``
2310
sections. This is so that you *can* use interpolation in configspec
2313
``validate`` doesn't report *extra* values or sections.
2315
You can't have a keyword with the same name as a section (in the same
2316
section). They are both dictionary keys - so they would overlap.
2318
ConfigObj doesn't quote and unquote values if ``list_values=False``.
2319
This means that leading or trailing whitespace in values will be lost when
2320
writing. (Unless you manually quote).
2322
Interpolation checks first the current section, then the 'DEFAULT' subsection
2323
of the current section, before moving on to the current section's parent and
2326
Does it matter that we don't support the ':' divider, which is supported
2327
by ``ConfigParser`` ?
2329
String interpolation and validation don't play well together. When
2330
validation changes type it sets the value. This will correctly fetch the
2331
value using interpolation - but then overwrite the interpolation reference.
2332
If the value is unchanged by validation (it's a string) - but other types
1710
2339
This is an abbreviated changelog showing the major releases up to version 4.
1711
From version 4 it lists all releases and changes. *More* data on individual
1712
changes may be found in the source code.
2340
From version 4 it lists all releases and changes.
2343
2008/02/05 - Version 4.5.2
2344
--------------------------
2346
Distribution updated to include version 0.3.2 of validate_. This means that
2347
``None`` as a default value win configspecs works.
2350
2008/02/05 - Version 4.5.1
2351
--------------------------
2353
Distribution updated to include version 0.3.1 of validate_. This means that
2354
Unicode configspecs now work.
2357
2008/02/05 - Version 4.5.0
2358
--------------------------
2360
ConfigObj will now guarantee that files will be written terminated with a
2363
ConfigObj will no longer attempt to import the ``validate`` module, until/unless
2364
you call ``ConfigObj.validate`` with ``preserve_errors=True``. This makes it
2367
New methods ``restore_default`` and ``restore_defaults``. ``restore_default``
2368
resets an entry to its default value (and returns that value). ``restore_defaults``
2369
resets all entries to their default value. It doesn't modify entries without a
2370
default value. You must have validated a ConfigObj (which populates the
2371
``default_values`` dictionary) before calling these methods.
2373
BUGFIX: Proper quoting of keys, values and list values that contain hashes
2374
(when writing). When ``list_values=False``, values containing hashes are
2377
Added the ``reload`` method. This reloads a ConfigObj from file. If the filename
2378
attribute is not set then a ``ReloadError`` (a new exception inheriting from
2379
``IOError``) is raised.
2381
BUGFIX: Files are read in with 'rb' mode, so that native/non-native line endings work!
2383
Minor efficiency improvement in ``unrepr`` mode.
2385
Added missing docstrings for some overidden dictionary methods.
2387
Added the ``reset`` method. This restores a ConfigObj to a freshly created state.
2389
Removed old CHANGELOG file.
2392
2007/02/04 - Version 4.4.0
2393
--------------------------
2395
Official release of 4.4.0
2398
2006/12/17 - Version 4.3.3-alpha4
2399
---------------------------------
2403
Allowed arbitrary indentation in the ``indent_type`` parameter, removed the
2404
``NUM_INDENT_SPACES`` and ``MAX_INTERPOL_DEPTH`` (a leftover) constants,
2405
added indentation tests (including another docutils workaround, sigh), updated
2410
Made the import of ``compiler`` conditional so that ``ConfigObj`` can be used
2411
with `IronPython <http://www.codeplex.com/IronPython>`_.
2414
2006/12/17 - Version 4.3.3-alpha3
2415
---------------------------------
2419
Added a missing ``self.`` in the _handle_comment method and a related test,
2420
per Sourceforge bug #1523975.
2423
2006/12/09 - Version 4.3.3-alpha2
2424
---------------------------------
2428
Changed interpolation search strategy, based on this patch by Robin Munn:
2429
http://sourceforge.net/mailarchive/message.php?msg_id=17125993
2432
2006/12/09 - Version 4.3.3-alpha1
2433
---------------------------------
2437
Added Template-style interpolation, with tests, based on this patch by
2438
Robin Munn: http://sourceforge.net/mailarchive/message.php?msg_id=17125991
2439
(awful archives, bad Sourceforge, bad).
2442
2006/06/04 - Version 4.3.2
2443
--------------------------
2445
Changed error handling, if parsing finds a single error then that error will
2446
be re-raised. That error will still have an ``errors`` and a ``config``
2449
Fixed bug where '\\n' terminated files could be truncated.
2451
Bugfix in ``unrepr`` mode, it couldn't handle '#' in values. (Thanks to
2452
Philippe Normand for the report.)
2454
As a consequence of this fix, ConfigObj doesn't now keep inline comments in
2455
``unrepr`` mode. This is because the parser in the `compiler package`_
2456
doesn't keep comments. {sm;:-)}
2458
Error messages are now more useful. They tell you the number of parsing errors
2459
and the line number of the first error. (In the case of multiple errors.)
2461
Line numbers in exceptions now start at 1, not 0.
2463
Errors in ``unrepr`` mode are now handled the same way as in the normal mode.
2464
The errors stored will be an ``UnreprError``.
2467
2006/04/29 - Version 4.3.1
2468
--------------------------
2470
Added ``validate.py`` back into ``configobj.zip``. (Thanks to Stewart
2473
Updated to `validate.py`_ 0.2.2.
2475
Preserve tuples when calling the ``dict`` method. (Thanks to Gustavo Niemeyer.)
2477
Changed ``__repr__`` to return a string that contains ``ConfigObj({ ... })``.
2479
Change so that an options dictionary isn't modified by passing it to ConfigObj.
2480
(Thanks to Artarious.)
2482
Added ability to handle negative integers in ``unrepr``. (Thanks to Kevin
2486
2006/03/24 - Version 4.3.0
2487
--------------------------
2489
Moved the tests and the CHANGELOG (etc) into a separate file. This has reduced
2490
the size of ``configobj.py`` by about 40%.
2492
Added the ``unrepr`` mode to reading and writing config files. Thanks to Kevin
2493
Dangoor for this suggestion.
2495
Empty values are now valid syntax. They are read as an empty string ``''``.
2496
(``key =``, or ``key = # comment``.)
2498
``validate`` now honours the order of the configspec.
2500
Added the ``copy`` mode to validate. Thanks to Louis Cordier for this
2503
Fixed bug where files written on windows could be given ``'\r\r\n'`` line
2506
Fixed bug where last occurring comment line could be interpreted as the
2507
final comment if the last line isn't terminated.
2509
Fixed bug where nested list values would be flattened when ``write`` is
2510
called. Now sub-lists have a string representation written instead.
2512
Deprecated ``encode`` and ``decode`` methods instead.
2514
You can now pass in a ConfigObj instance as a configspec (remember to read
2515
the configspec file using ``list_values=False``).
2517
Sorted footnotes in the docs.
2520
2006/02/16 - Version 4.2.0
2521
--------------------------
2523
Removed ``BOM_UTF8`` from ``__all__``.
2525
The ``BOM`` attribute has become a boolean. (Defaults to ``False``.) It is
2526
*only* ``True`` for the ``UTF16/UTF8`` encodings.
2528
File like objects no longer need a ``seek`` attribute.
2530
Full unicode support added. New options/attributes ``encoding``,
2531
``default_encoding``.
2533
ConfigObj no longer keeps a reference to file like objects. Instead the
2534
``write`` method takes a file like object as an optional argument. (Which
2535
will be used in preference of the ``filename`` attribute if that exists as
2538
utf16 files decoded to unicode.
2540
If ``BOM`` is ``True``, but no encoding specified, then the utf8 BOM is
2541
written out at the start of the file. (It will normally only be ``True`` if
2542
the utf8 BOM was found when the file was read.)
2544
Thanks to Aaron Bentley for help and testing on the unicode issues.
2546
File paths are *not* converted to absolute paths, relative paths will
2547
remain relative as the ``filename`` attribute.
2549
Fixed bug where ``final_comment`` wasn't returned if ``write`` is returning
2552
Deprecated ``istrue``, replaced it with ``as_bool``.
2554
Added ``as_int`` and ``as_float``.
2557
2005/12/14 - Version 4.1.0
2558
--------------------------
2560
Added ``merge``, a recursive update.
2562
Added ``preserve_errors`` to ``validate`` and the ``flatten_errors``
2565
Thanks to Matthew Brett for suggestions and helping me iron out bugs.
2567
Fixed bug where a config file is *all* comment, the comment will now be
2568
``initial_comment`` rather than ``final_comment``.
2570
Validation no longer done on the 'DEFAULT' section (only in the root level).
2571
This allows interpolation in configspecs.
2573
Also use the new list syntax in validate_ 0.2.1. (For configspecs).
2576
2005/12/02 - Version 4.0.2
2577
--------------------------
2579
Fixed bug in ``create_empty``. Thanks to Paul Jimenez for the report.
2582
2005/11/05 - Version 4.0.1
2583
--------------------------
2585
Fixed bug in ``Section.walk`` when transforming names as well as values.
2587
Added the ``istrue`` method. (Fetches the boolean equivalent of a string
2590
Fixed ``list_values=False`` - they are now only quoted/unquoted if they
2591
are multiline values.
2593
List values are written as ``item, item`` rather than ``item,item``.
1714
2596
2005/10/17 - Version 4.0.0
1715
2597
--------------------------
1866
2756
A couple of bugs have been fixed.
1871
2762
ConfigObj originated in a set of functions for reading config files in the
1872
atlantibots_ project. The original functions were written by Rob McNeur...
2763
`atlantibots <http://www.voidspace.org.uk/atlantibots/>`_ project. The original
2764
functions were written by Rob McNeur.
1874
.. _atlantibots: http://www.voidspace.org.uk/atlantibots
1881
.. [#] The core parser is now based on regular expressions, so it's a lot
1884
.. [#] 134 of them, at the time of writing.
1886
2773
.. [#] And if you discover any bugs, let us know. We'll fix them quickly.
1888
2775
.. [#] If you specify a filename that doesn't exist, ConfigObj will assume you
1889
2776
are creating a new one. See the *create_empty* and *file_error* options_.
1891
.. [#] They can be byte strings ('ordinary' strings) or Unicode. If they are
1892
Unicode then ConfigObj will have to do an implicit encode before writing.
1893
See the encodings_ section for more details.
2778
.. [#] They can be byte strings (*ordinary* strings) or Unicode.
1895
2780
.. [#] Except we don't support the RFC822 style line continuations, nor ':' as
1898
.. [#] For a file object that will depend what mode it was opened with. You
1899
can read *and* write to a ``StringIO`` instance, but not always to a
1900
``cStringIO`` instance.
2783
.. [#] This is a change in ConfigObj 4.2.0. Note that ConfigObj doesn't call
2784
the seek method of any file like object you pass in. You may want to call
2785
``file_object.seek(0)`` yourself, first.
1902
2787
.. [#] A side effect of this is that it enables you to copy a ConfigObj :
1908
# only copies members
1909
# not attributes/comments
1910
config2 = ConfigObj(config1)
2793
# only copies members
2794
# not attributes/comments
2795
config2 = ConfigObj(config1)
1916
2799
The order of values and sections will not be preserved, though.
1918
2801
.. [#] Other than lists of strings.
1920
.. [#] The method signature in the API docs will show that it does in fact
1921
take one argument: the section to be written. This is because the
1922
``write`` method is called recursively. Using this argument *forces* write
1923
to return a list of lines, so it's probably not very useful to you.
2803
.. [#] The exception is if it detects a ``UTF16`` encoded file which it
2804
must decode before parsing.
2806
.. [#] The method signature shows that this method takes
2807
two arguments. The second is the section to be written. This is because the
2808
``write`` method is called recursively.
1925
2810
.. [#] The dict method doesn't actually use the deepcopy mechanism. This means
1926
2811
if you add nested lists (etc) to your ConfigObj, then the dictionary