naps / confiture Goto Github PK
View Code? Open in Web Editor NEWConfigure your projects with taste!
Home Page: https://pypi.python.org/pypi/confiture
License: MIT License
Configure your projects with taste!
Home Page: https://pypi.python.org/pypi/confiture
License: MIT License
I got the following error:
Traceback (most recent call last):
File "test3.py", line 108, in <module>
pconfig = config.parse()
File "/home/antoine/Devel/dotconf/dotconf/__init__.py", line 28, in parse
config = self._schema.validate(config)
File "/home/antoine/Devel/dotconf/dotconf/schema/containers.py", line 403, in validate
validated_section.register(child, name=name)
File "/home/antoine/Devel/dotconf/dotconf/tree.py", line 106, in register
raise TypeError('Child must be a ConfigValue or ConfigSection object')
TypeError: Child must be a ConfigValue or ConfigSection object
Seem because ConfigSection.iteritems() returns a list of section instead of expanding it.
When working on windows and unix (e.g. writing configuration file under windows, but parsing it with python installed on cygwin), there is this inconsistence with different line breaks. For the mentioned example, the configuration file contains \r\n line breaks, but unix python does not allow this and we get the ParsingError:
Illegal character u'\r'
To prevent this, an easy solution is available. Just change the first line of from_filename function from
fconf = open(filename)
to
fconf = open(filename, 'Ur')
This allows universal line breaks and can treat any of the unix/mac/windows line break styles like described in: http://docs.python.org/2/library/functions.html#open
If I write a section into the configuration that is not inside the schema, a traceback is raised at line 404 in containers.py.
Usually, for normal assignment values, an error like this is raised:
dotconf.schema.ValidationError: section path, unknown key <my-key>
But for an unknown section, the following traceback is raised from containers.py:
raise ValidationError(msg, position=child.position)
AttributeError: 'list' object has no attribute 'position'
If a section with the meta
_meta = {'args': None, 'repeat': (0, 1)}
is declared in schema, the section has to be included in the configuration although it is optional. However, an error is raised in a code-area where missing attributes are checked (line 404 in containers.py).
For an optional section, I recommend that it is still a known key. This means that
parsed_conf.subsections('my-optional-section')
returns an empty list so that iterating over all (optional) sections is still possible but will simply do nothing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.