You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
(2) |
Nov
(18) |
Dec
(26) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(14) |
Feb
(28) |
Mar
(21) |
Apr
(17) |
May
(23) |
Jun
(12) |
Jul
(12) |
Aug
(7) |
Sep
(10) |
Oct
|
Nov
(4) |
Dec
(10) |
| 2007 |
Jan
(5) |
Feb
(8) |
Mar
|
Apr
|
May
(7) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(20) |
Oct
(3) |
Nov
(2) |
Dec
(12) |
| 2008 |
Jan
(40) |
Feb
(15) |
Mar
(1) |
Apr
|
May
(6) |
Jun
(19) |
Jul
(2) |
Aug
(17) |
Sep
(13) |
Oct
(7) |
Nov
(16) |
Dec
(5) |
| 2009 |
Jan
(15) |
Feb
(11) |
Mar
(11) |
Apr
(8) |
May
(6) |
Jun
(15) |
Jul
(19) |
Aug
(2) |
Sep
|
Oct
(19) |
Nov
(1) |
Dec
(3) |
| 2010 |
Jan
(12) |
Feb
(25) |
Mar
(45) |
Apr
(4) |
May
(2) |
Jun
(4) |
Jul
(6) |
Aug
(13) |
Sep
(1) |
Oct
(2) |
Nov
(2) |
Dec
(9) |
| 2011 |
Jan
(24) |
Feb
(7) |
Mar
(1) |
Apr
(6) |
May
(3) |
Jun
(3) |
Jul
|
Aug
(13) |
Sep
(9) |
Oct
(7) |
Nov
(17) |
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
(5) |
Apr
(3) |
May
|
Jun
|
Jul
(3) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(12) |
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
(4) |
Feb
(3) |
Mar
|
Apr
(17) |
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(3) |
Oct
(3) |
Nov
|
Dec
|
| 2015 |
Jan
(11) |
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
(2) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
(10) |
Dec
|
| 2017 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Michael F. <fuz...@vo...> - 2009-03-07 13:42:44
|
kat kat wrote:
> Hello All,
>
> I need to retrieve a value of a key in the configuration file as a raw
> string but somehow after ConfigObj reads it, it is escaping special
> characters. For e.g, here is my configuration file:
>
> [ "constants" ]
> 'target_dir' = r"C:\tmpdir"
>
> As you see above I have declared "target_dir" key's value to be a raw
> string which should be evaluated literally, that is the backslash
> present in the value should not be escaped.
The raw string format is not valid ConfigObj syntax. This is what
happens when I run your example:
>>> open('cfg.txt', 'w').write("""[ "constants" ]
... 'target_dir' = r"C:\\tmpdir\"""")
>>> from configobj import ConfigObj
>>> c = ConfigObj('cfg.txt')
>>> c['constants']['target_dir']
'r"C:\\tmpdir"'
>>>
See how the r is actually included in the value!
If we remove the leading r from the string then as far as I can tell you
get what you are asking for anyway?
>>> open('cfg.txt', 'w').write("""[ "constants" ]
... 'target_dir' = "C:\\tmpdir\"""")
>>> c = ConfigObj('cfg.txt')
>>> c['constants']['target_dir']
'C:\\tmpdir'
If you are asking for this: 'C:\tmpdir' then you are simply confused
about how Python handles strings - there isn't really two backslashes in
the string, there is one but it has to be escaped to be displayed.
Michael
>
> I am reading the file like this:
>
> >>> from configobj import ConfigObj
> >>> config = ConfigObj("tmp.cfg")
> >>> dir = config['constants']['target_dir']
> >>> dir
> 'C:\\tmpdir'
>
> although this is OK:
> >>> print dir
> 'C:\tmpdir'
>
> but when we do print, the string is evaluated.
>
> If you see, the backslash gets escaped and I no longer get the raw
> string I had in my configuration file.
>
> What should I do so that ConfigObj reads that value as a raw string
> and give me r"C:\tmpdir" instead of "C:\\tmpdir"
>
> Thanks much for your help
>
> -kk
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ------------------------------------------------------------------------
>
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
|
|
From: kat k. <dok...@gm...> - 2009-03-07 06:30:30
|
Hello All,
I need to retrieve a value of a key in the configuration file as a raw
string but somehow after ConfigObj reads it, it is escaping special
characters. For e.g, here is my configuration file:
[ "constants" ]
'target_dir' = r"C:\tmpdir"
As you see above I have declared "target_dir" key's value to be a raw string
which should be evaluated literally, that is the backslash present in the
value should not be escaped.
I am reading the file like this:
>>> from configobj import ConfigObj
>>> config = ConfigObj("tmp.cfg")
>>> dir = config['constants']['target_dir']
>>> dir
'C:\\tmpdir'
although this is OK:
>>> print dir
'C:\tmpdir'
but when we do print, the string is evaluated.
If you see, the backslash gets escaped and I no longer get the raw string I
had in my configuration file.
What should I do so that ConfigObj reads that value as a raw string and give
me r"C:\tmpdir" instead of "C:\\tmpdir"
Thanks much for your help
-kk
|
|
From: Marc T. <mar...@gm...> - 2009-03-06 21:10:04
|
On Sun, Mar 1, 2009 at 7:18 PM, Michael Foord <fuz...@vo...>wrote:
> In the meantime your two phase replace sounds like our only option. You
> could replace each apostrophe with a unique character combination and
> then us walk() to replace every occurrence again after reading.
>
Since you followed up, I figured I'd go ahead and post my eventual
solution. Could probably be more elegant, but it does what I need it to...
from __future__ import with_statement
import os, zipfile, textwrap
from configobj import ConfigObj
class mcrCodes(object):
"""
Provides dictionary of Medicare reason codes.
Methods:
__init__ - create dictionary
lookup - return formatted explanation for given code
Attributes:
codes - dictionary of codes, explanations, and valid dates
releaseDate - date working version of Codes.ini was released
"""
def __init__(self, codeFileName=os.getcwd() + os.sep +
"MedicareRemitEasyPrint.zip"):
"""
If codeFileName is a zip file, it will be searched for a 'Codes.ini'
file;
if not, codeFileName will be accessed directly.
ConfigObj interprets internal quotes, so we replace apostrophes with
backquotes before passing file to ConfigObj.
"""
if zipfile.is_zipfile(codeFileName):
piz = zipfile.ZipFile(codeFileName)
for item in piz.infolist():
if item.filename[-3:] == "ini":
inFile = piz.read(item.filename)
tmpCodes = inFile.splitlines()
else:
with open(codeFileName,'r') as inFile:
tmpCodes = inFile.readlines()
self.releaseDate = tmpCodes.pop(0)
for index, line in enumerate(tmpCodes):
tmpCodes[index] = line.replace("\'", "`")
self.codes = ConfigObj(tmpCodes, raise_errors=True,
list_values=False)
def lookup(self, inStr=None, width=70, para=True):
"""
Return a text-wrapped paragraph or list of lines containing
explanation text for the code passed in inStr.
inStr - code to be looked up
width - line length to wrap to
para - if True, return paragraph; if False, return list of lines
"""
wrp = textwrap.TextWrapper(width=width, initial_indent=inStr+" - ",
subsequent_indent=" ")
try:
outStr = self.codes[inStr]["Message"].replace("`", "'") # change
backquotes back to apostrophes
except KeyError:
outStr = "Sorry, no explanatory text is available for this
code. Make sure your code file is up-to-date."
if para:
return wrp.fill(outStr)
else:
return wrp.wrap(outStr)
--
www.fsrtechnologies.com
|
|
From: Michael F. <fuz...@vo...> - 2009-03-06 20:33:41
|
Marc Tompkins wrote:
> On Sun, Mar 1, 2009 at 12:12 PM, Marc Tompkins
> <mar...@gm... <mailto:mar...@gm...>> wrote:
>
> There aren't any "real" quotes in this file - is there any way to
> tell ConfigObj to ignore any single-quote characters it finds? If
> not, any clever ideas for a workaround? I did think of replacing
> "'" with "-" or something, but there are plenty of contractions in
> this file, and "doesn-t" doesn't look very pretty. On the other
> hand, searching for all matched pairs of quotes that appear in the
> same data item would require me to... well, to re-invent much of
> the guts of ConfigObj itself, no?
>
>
> I came up with an ugly workaround - actually, it's fine for my
> purposes, but typographically wrong - I'm replacing all the
> apostrophes with backticks. I'm hoping my users won't notice.
> Actually, of course, I could do another replacement just before
> printing; I might do that later on if I'm bored.
I'm afraid that you're trying to read a configuration file format that
ConfigObj wasn't designed to work with. A different ConfigObj could have
a pluggable parser with a flexible grammar, but I don't have time to
write that one...
In the meantime your two phase replace sounds like our only option. You
could replace each apostrophe with a unique character combination and
then us walk() to replace every occurrence again after reading.
Michael Foord
>
> Here's my first pass at the problem:
>
> class mcrCodes(object):
>
> def __init__(self, codeFileName="C:/temp/Codes.ini"):
> with open(codeFileName,'r') as inFile:
> tmpCodes = inFile.readlines()
> releaseDate = tmpCodes.pop(0)
> for index, line in enumerate(tmpCodes):
> tmpCodes[index] = line.replace("\'", "`")
> self.codes = ConfigObj(tmpCodes, raise_errors=True,
> list_values=False)
>
> codeFile = mcrCodes()
> for code, val in codeFile.codes.iteritems():
> print code, val
>
>
> --
> www.fsrtechnologies.com <http://www.fsrtechnologies.com>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ------------------------------------------------------------------------
>
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
--
http://www.ironpythoninaction.com/
|
|
From: Michael F. <fuz...@vo...> - 2009-03-02 15:04:20
|
Marc Tompkins wrote: > On Sun, Mar 1, 2009 at 6:21 PM, Marc Tompkins <mar...@gm... > <mailto:mar...@gm...>> wrote: > > I came up with an ugly workaround - actually, it's fine for my > purposes, but typographically wrong - I'm replacing all the > apostrophes with backticks. I'm hoping my users won't notice. > Actually, of course, I could do another replacement just before > printing; I might do that later on if I'm bored. > > For the sake of completeness, I thought I'd follow up - like most > things, it turned out to be very simple in the end. I wanted this > class to look up the code and return the Message as a text-wrapped > paragraph (or list of lines) anyway, so I just replace "`" with "'" > before textwrapping, and everything is cool and groovy. > > Sorry for the waste of bandwidth. > Not a problem. :-) Michael > -- > www.fsrtechnologies.com <http://www.fsrtechnologies.com> > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > ------------------------------------------------------------------------ > > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > -- http://www.ironpythoninaction.com/ |
|
From: Marc T. <mar...@gm...> - 2009-03-02 10:50:47
|
On Sun, Mar 1, 2009 at 6:21 PM, Marc Tompkins <mar...@gm...>wrote: > I came up with an ugly workaround - actually, it's fine for my purposes, > but typographically wrong - I'm replacing all the apostrophes with > backticks. I'm hoping my users won't notice. Actually, of course, I could > do another replacement just before printing; I might do that later on if I'm > bored. > For the sake of completeness, I thought I'd follow up - like most things, it turned out to be very simple in the end. I wanted this class to look up the code and return the Message as a text-wrapped paragraph (or list of lines) anyway, so I just replace "`" with "'" before textwrapping, and everything is cool and groovy. Sorry for the waste of bandwidth. -- www.fsrtechnologies.com |
|
From: Marc T. <mar...@gm...> - 2009-03-02 02:22:01
|
On Sun, Mar 1, 2009 at 12:12 PM, Marc Tompkins <mar...@gm...>wrote:
> There aren't any "real" quotes in this file - is there any way to tell
> ConfigObj to ignore any single-quote characters it finds? If not, any
> clever ideas for a workaround? I did think of replacing "'" with "-" or
> something, but there are plenty of contractions in this file, and "doesn-t"
> doesn't look very pretty. On the other hand, searching for all matched
> pairs of quotes that appear in the same data item would require me to...
> well, to re-invent much of the guts of ConfigObj itself, no?
>
I came up with an ugly workaround - actually, it's fine for my purposes, but
typographically wrong - I'm replacing all the apostrophes with backticks.
I'm hoping my users won't notice. Actually, of course, I could do another
replacement just before printing; I might do that later on if I'm bored.
Here's my first pass at the problem:
> class mcrCodes(object):
>
> def __init__(self, codeFileName="C:/temp/Codes.ini"):
> with open(codeFileName,'r') as inFile:
> tmpCodes = inFile.readlines()
> releaseDate = tmpCodes.pop(0)
> for index, line in enumerate(tmpCodes):
> tmpCodes[index] = line.replace("\'", "`")
> self.codes = ConfigObj(tmpCodes, raise_errors=True,
> list_values=False)
>
> codeFile = mcrCodes()
> for code, val in codeFile.codes.iteritems():
> print code, val
>
--
www.fsrtechnologies.com
|
|
From: Marc T. <mar...@gm...> - 2009-03-01 20:12:20
|
I'm using ConfigObj to parse Medicare's list of error/comment codes (when a physician receives an electronic explanation of benefits, it's full of these codes telling him/her exactly why Medicare isn't paying squat.) The file is called "Codes.ini", and generally follows INI conventions, except that: - the first line is a release date - no "=", no nothing. I got around that by opening the file first, doing a readlines(), and pop()ing the date off for use elsewhere. - at about 75%, the following appears: > [188] > Message=This product/procedure is only covered when used according to FDA > recommendations. > EffDate=6/30/2005 > DeactDate= > Modified= > Note= > [189] > Message='Not otherwise classified' or 'unlisted' procedure code (CPT/HCPCS) > was billed when there is a specific procedure code for this > procedure/service > EffDate=6/30/2005 > DeactDate= > Modified= > Note= (I include number 188 just to show what these entries look like - the trouble begins with the Message for number 189.) Here's what I get: > Traceback (most recent call last): > File "E:\fsrPy\fsrStuff\mcrCodes.pyw", line 19, in <module> > codeFile = mcrCodes() > File "E:\fsrPy\fsrStuff\mcrCodes.pyw", line 17, in __init__ > self.codes = ConfigObj(tmpCodes, raise_errors=True) > File "C:\Python25\lib\site-packages\configobj.py", line 1272, in __init__ > self._load(infile, configspec) > File "C:\Python25\lib\site-packages\configobj.py", line 1341, in _load > self._parse(infile) > File "C:\Python25\lib\site-packages\configobj.py", line 1687, in _parse > ParseError, infile, cur_index) > File "C:\Python25\lib\site-packages\configobj.py", line 1748, in > _handle_error > raise error > configobj.ParseError: Parse error in value at line 5888. > There aren't any "real" quotes in this file - is there any way to tell ConfigObj to ignore any single-quote characters it finds? If not, any clever ideas for a workaround? I did think of replacing "'" with "-" or something, but there are plenty of contractions in this file, and "doesn-t" doesn't look very pretty. On the other hand, searching for all matched pairs of quotes that appear in the same data item would require me to... well, to re-invent much of the guts of ConfigObj itself, no? If you're interested, the code file is available here: http://www.cms.hhs.gov/AccesstoDataApplication/Downloads/MedicareRemitEasyPrint.zip (it's inside the zip file). Thanks! -- www.fsrtechnologies.com |
|
From: Michael F. <fuz...@vo...> - 2009-02-27 17:29:21
|
Jeffrey Barish wrote:
> On Friday 16 January 2009 04:07:43 Michael Foord wrote:
>
>> Jeffrey Barish wrote:
>>
>>> On Monday 12 January 2009 08:16:57 Michael Foord wrote:
>>>
>>>> Jeffrey Barish wrote:
>>>>
>>>>> I write the repr of a tuple to my configuration file on exit. Usually,
>>>>> I find "<tuple>" in my configuration file afterward, but occasionally
>>>>> the quotation marks are missing. I have not been able to detect a
>>>>> pattern. Any suggestions?
>>>>>
>>>> Is it actually causing any problems?
>>>>
>>> Or worse: If the value in the configuration file is
>>>
>>> ('a', ['b', 'c'])
>>>
>>> then I get a ParseError (at line 8) when I try to read it. That error I
>>> cannot fix.
>>>
>>> BTW, I am using version 4.5.3.
>>>
>> Did you have any luck reproducing this?
>>
>> Michael
>>
>
> I finally figured out what was going on here, but I am still unclear about one
> point. In my configuration file, I have a line like
>
> atuple = "('a', ['b', 'c'])"
>
> I created a validator for the purpose of converting that string to a tuple.
> The problem arises when I call the write method because a tuple gets written
> back to the configuration file rather than a repr of a tuple. I suspect that
> configobj is working the way it is supposed to work, but what I wanted was to
> be handed a tuple yet still have the write method write the repr of the
> tuple. Currently, I have turned off the conversion in the validator and
> instead perform the conversion in my program. I am not happy that I must
> have eval's scattered throughout my code to perform the conversion previously
> performed centrally in the validator. I'm wondering whether there is a way
> to restore the conversion provided in the validator but still have the write
> method write the value in its original form.
>
> FWIW, here's a test program configtest.py:
>
> import configobj, validate, os
>
> CONFIGRC = os.path.join(os.getcwd(), 'configrc')
>
> class Configurator(configobj.ConfigObj):
> def __init__(self):
> configobj.ConfigObj.__init__(self, CONFIGRC,
> configspec=CONFIGRC+'.spec')
> val = validate.Validator({'check_tuple': self._tuple_validator})
> res = self.validate(val, preserve_errors=True)
>
> def _tuple_validator(self, val, default=None):
> return eval(val)
> #return val
>
> if __name__ == '__main__':
> config = Configurator()
> config.write()
>
> configrc:
>
> atuple = "('One', ['Two'])"
>
> configrc.spec:
>
> atuple = check_tuple()
>
>
You could try unrepr mode which should allow you to read and write
tuples without the need for validation functions - the syntax is
slightly different from normal ConfigObj files though as it uses Python
syntax for strings, lists, tuples and dicts.
If ConfigObj writes tuples out in a way that it can't read back in then
I can understand how that is frustrating - although ConfigObj is not
really intended to be *able* to do that, particularly tuples with nested
lists. You could easily use ConfigObj.walk to transform tuple values
back into *correct* strings before calling write.
Michael
--
http://www.ironpythoninaction.com/
|
|
From: Jeffrey B. <jef...@ea...> - 2009-02-26 21:54:10
|
On Friday 16 January 2009 04:07:43 Michael Foord wrote:
> Jeffrey Barish wrote:
> > On Monday 12 January 2009 08:16:57 Michael Foord wrote:
> >> Jeffrey Barish wrote:
> >>> I write the repr of a tuple to my configuration file on exit. Usually,
> >>> I find "<tuple>" in my configuration file afterward, but occasionally
> >>> the quotation marks are missing. I have not been able to detect a
> >>> pattern. Any suggestions?
> >>
> >> Is it actually causing any problems?
> >
> > Or worse: If the value in the configuration file is
> >
> > ('a', ['b', 'c'])
> >
> > then I get a ParseError (at line 8) when I try to read it. That error I
> > cannot fix.
> >
> > BTW, I am using version 4.5.3.
>
> Did you have any luck reproducing this?
>
> Michael
I finally figured out what was going on here, but I am still unclear about one
point. In my configuration file, I have a line like
atuple = "('a', ['b', 'c'])"
I created a validator for the purpose of converting that string to a tuple.
The problem arises when I call the write method because a tuple gets written
back to the configuration file rather than a repr of a tuple. I suspect that
configobj is working the way it is supposed to work, but what I wanted was to
be handed a tuple yet still have the write method write the repr of the
tuple. Currently, I have turned off the conversion in the validator and
instead perform the conversion in my program. I am not happy that I must
have eval's scattered throughout my code to perform the conversion previously
performed centrally in the validator. I'm wondering whether there is a way
to restore the conversion provided in the validator but still have the write
method write the value in its original form.
FWIW, here's a test program configtest.py:
import configobj, validate, os
CONFIGRC = os.path.join(os.getcwd(), 'configrc')
class Configurator(configobj.ConfigObj):
def __init__(self):
configobj.ConfigObj.__init__(self, CONFIGRC,
configspec=CONFIGRC+'.spec')
val = validate.Validator({'check_tuple': self._tuple_validator})
res = self.validate(val, preserve_errors=True)
def _tuple_validator(self, val, default=None):
return eval(val)
#return val
if __name__ == '__main__':
config = Configurator()
config.write()
configrc:
atuple = "('One', ['Two'])"
configrc.spec:
atuple = check_tuple()
--
Jeffrey Barish
|
|
From: Michael F. <fuz...@vo...> - 2009-02-19 20:40:51
|
Hello David,
Great - I'll integrate this ASAP. ConfigObj is due a new release so I
can do them together.
I agree that doctest is a pain for unit testing, but unless someone
volunteers to port all the existing tests...
Michael
David Hostetler wrote:
> See attached.
>
> Note that the version bump to '0.3.3' was just because I'm using this
> in the context of systems that do module version checking and I
> needed/wanted to distinguish the updated version from both the
> published version and the svn tip.
>
> Note also that I updated one of the dottedQuadToNum() tests - not sure
> if this was a platform/python version idiosyncrasy or what, but I had
> to fix it to get a clean doctest run.
>
> Let me know if there are any issues.
>
> p.s. -- using doctest for this kind of thing was cumbersome. Are you
> considering unittest for actual tests, and just leaving doctest for
> validating docstring examples?
>
>
> regards,
>
> -hoss
>
> David Hostetler
> neg...@gm... <mailto:neg...@gm...>
>
>
> On Thu, Feb 19, 2009 at 15:11, Michael Foord
> <fuz...@vo... <mailto:fuz...@vo...>> wrote:
>
> David Hostetler wrote:
> > I have the newline support implemented (with tests).
> >
> > Would you prefer a diff, or just the validate.py?
>
> Diff against svn head is perfect.
>
> Michael
>
> >
> > cheers,
> >
> > -hoss
> >
> > On Wed, Jan 28, 2009 at 18:17, Michael Foord
> > <fuz...@vo... <mailto:fuz...@vo...>
> <mailto:fuz...@vo...
> <mailto:fuz...@vo...>>> wrote:
> >
> > David Hostetler wrote:
> > > I'm having a devil of a time getting validate to allow for the
> > default
> > > value of a string check to consist of a string that includes a
> > newline
> > > character ('\n'). I've tried several syntactic variants, and
> > nothing
> > > is working - the validation fails everytime.
> > >
> > > E.g.:
> > >
> > > spec = { u'val': u"string(default='%s')" % ('\n') }
> > > cfgdict = {}
> > >
> > > vtor = validate.Validator()
> > > cfg = configobj.ConfigObj(cfgdict, configspec=spec)
> > >
> > > results = cfg.validate(vtor, preserve_errors=True)
> > >
> > > In addition to the spec as shown above, I've tried:
> > >
> > > spec = { u'val': u"string(default='\n')" }
> > >
> > > spec = { u'val': u""""string(default='
> > > ')""" }
> > >
> > >
> > > I even tried putting the spec into a text block and using
> > splitlines()
> > > and giving that as the configspec argument (where the text
> block
> > used
> > > the '''<value>''' syntax for multi-line values).
> > >
> > > No joy.
> > >
> > > The validation parser seems to treat any newline as the
> end of the
> > > spec definition for that particular value, and either
> bombs out
> > with a
> > > parse error, or returns False upon validation.
> > >
> > > Any tips? Bug?
> >
> > Hmm... probably the regular expression matching used in
> validation
> > can't
> > handle the newlines. Hopefully adding re.DOTALL to some of
> the regular
> > expressions in validate.py will fix it.
> >
> > I'm unlikely to be able to get to it for a few weeks - so
> patches
> > (including tests!) welcomed. :-)
> >
> > All the best,
> >
> >
> > Michael Foord
> >
> >
> >
> ------------------------------------------------------------------------
> >
> >
> ------------------------------------------------------------------------------
> > Open Source Business Conference (OSBC), March 24-25, 2009, San
> Francisco, CA
> > -OSBC tackles the biggest issue in open source: Open Sourcing
> the Enterprise
> > -Strategies to boost innovation and cut costs with open source
> participation
> > -Receive a $600 discount off the registration fee with the
> source code: SFAD
> > http://p.sf.net/sfu/XcvMzF8H
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Configobj-develop mailing list
> > Con...@li...
> <mailto:Con...@li...>
> > https://lists.sourceforge.net/lists/listinfo/configobj-develop
> >
>
>
> --
> http://www.ironpythoninaction.com/
> http://www.voidspace.org.uk/blog
>
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San
> Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source
> code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> <mailto:Con...@li...>
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ------------------------------------------------------------------------
>
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
|
|
From: David H. <neg...@gm...> - 2009-02-19 20:26:09
|
Index: validate.py
===================================================================
--- validate.py (revision 106)
+++ validate.py (working copy)
@@ -130,7 +130,7 @@
__docformat__ = "restructuredtext en"
-__version__ = '0.3.2'
+__version__ = '0.3.3'
__revision__ = '$Id: validate.py 123 2005-09-08 08:54:28Z fuzzyman $'
@@ -183,15 +183,15 @@
(?:
\s*
(?:
- (?:".*?")| # double quotes
- (?:'.*?')| # single quotes
+ (?s)(?:".*?")| # double quotes
+ (?s)(?:'.*?')| # single quotes
(?:[^'",\s\)][^,\)]*?) # unquoted
)
\s*,\s*
)*
(?:
- (?:".*?")| # double quotes
- (?:'.*?')| # single quotes
+ (?s)(?:".*?")| # double quotes
+ (?s)(?:'.*?')| # single quotes
(?:[^'",\s\)][^,\)]*?) # unquoted
)? # last one
)
@@ -201,8 +201,8 @@
_list_members = re.compile(r'''
(
- (?:".*?")| # double quotes
- (?:'.*?')| # single quotes
+ (?s)(?:".*?")| # double quotes
+ (?s)(?:'.*?')| # single quotes
(?:[^'",\s=][^,=]*?) # unquoted
)
(?:
@@ -218,28 +218,28 @@
(?:
\s*
(?:
- (?:".*?")| # double quotes
- (?:'.*?')| # single quotes
- (?:[^'",\s\)][^,\)]*?) # unquoted
+ (?s)(?:".*?")| # double quotes
+ (?s)(?:'.*?')| # single quotes
+ (?:[^'",\s\)][^,\)]*?) # unquoted
)
\s*,\s*
)*
(?:
- (?:".*?")| # double quotes
- (?:'.*?')| # single quotes
- (?:[^'",\s\)][^,\)]*?) # unquoted
+ (?s)(?:".*?")| # double quotes
+ (?s)(?:'.*?')| # single quotes
+ (?:[^'",\s\)][^,\)]*?) # unquoted
)? # last one
\)
)|
(?:
- (?:".*?")| # double quotes
- (?:'.*?')| # single quotes
+ (?s)(?:".*?")| # double quotes
+ (?s)(?:'.*?')| # single quotes
(?:[^'",\s=][^,=]*?)| # unquoted
(?: # keyword argument
[a-zA-Z_][a-zA-Z0-9_]*\s*=\s*
(?:
- (?:".*?")| # double quotes
- (?:'.*?')| # single quotes
+ (?s)(?:".*?")| # double quotes
+ (?s)(?:'.*?')| # single quotes
(?:[^'",\s=][^,=]*?) # unquoted
)
)
@@ -278,7 +278,8 @@
>>> int(dottedQuadToNum('1.2.3.4'))
16909060
>>> dottedQuadToNum('1.2.3. 4')
- 16909060
+ Traceback (most recent call last):
+ ValueError: Not a good dotted-quad IP: 1.2.3. 4
>>> dottedQuadToNum('255.255.255.255')
4294967295L
>>> dottedQuadToNum('255.255.255.256')
@@ -525,10 +526,10 @@
"""
# this regex does the initial parsing of the checks
- _func_re = re.compile(r'(.+?)\((.*)\)')
+ _func_re = re.compile(r'(.+?)\((?s)(.*)\)')
# this regex takes apart keyword arguments
- _key_arg = re.compile(r'^([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(.*)$')
+ _key_arg = re.compile(r'^([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(?s)(.*)$')
# this regex finds keyword=list(....) type values
@@ -573,7 +574,7 @@
def check(self, check, value, missing=False):
- """
+ r"""
Usage: check(check, value)
Arguments:
@@ -592,6 +593,27 @@
>>> vtor.check('string(default="")', '', missing=True)
''
+ >>> vtor.check('string(default="\n")', '', missing=True)
+ '\n'
+ >>> print vtor.check('string(default="\n")', '', missing=True),
+ <BLANKLINE>
+ >>> vtor.check('string()', '\n')
+ '\n'
+ >>> vtor.check('string(default="\n\n\n")', '', missing=True)
+ '\n\n\n'
+ >>> vtor.check('string()', 'random \n text goes here\n\n')
+ 'random \n text goes here\n\n'
+ >>> vtor.check('string(default=" \nrandom text\ngoes \n here\n\n ")',
+ ... '', missing=True)
+ ' \nrandom text\ngoes \n here\n\n '
+ >>> vtor.check("string(default='\n\n\n')", '', missing=True)
+ '\n\n\n'
+ >>> vtor.check("option('\n','a','b',default='\n')", '', missing=True)
+ '\n'
+ >>> vtor.check("string_list()", ['foo', '\n', 'bar'])
+ ['foo', '\n', 'bar']
+ >>> vtor.check("string_list(default=list('\n'))", '', missing=True)
+ ['\n']
"""
fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check)
|
|
From: Michael F. <fuz...@vo...> - 2009-02-19 20:11:49
|
David Hostetler wrote:
> I have the newline support implemented (with tests).
>
> Would you prefer a diff, or just the validate.py?
Diff against svn head is perfect.
Michael
>
> cheers,
>
> -hoss
>
> On Wed, Jan 28, 2009 at 18:17, Michael Foord
> <fuz...@vo... <mailto:fuz...@vo...>> wrote:
>
> David Hostetler wrote:
> > I'm having a devil of a time getting validate to allow for the
> default
> > value of a string check to consist of a string that includes a
> newline
> > character ('\n'). I've tried several syntactic variants, and
> nothing
> > is working - the validation fails everytime.
> >
> > E.g.:
> >
> > spec = { u'val': u"string(default='%s')" % ('\n') }
> > cfgdict = {}
> >
> > vtor = validate.Validator()
> > cfg = configobj.ConfigObj(cfgdict, configspec=spec)
> >
> > results = cfg.validate(vtor, preserve_errors=True)
> >
> > In addition to the spec as shown above, I've tried:
> >
> > spec = { u'val': u"string(default='\n')" }
> >
> > spec = { u'val': u""""string(default='
> > ')""" }
> >
> >
> > I even tried putting the spec into a text block and using
> splitlines()
> > and giving that as the configspec argument (where the text block
> used
> > the '''<value>''' syntax for multi-line values).
> >
> > No joy.
> >
> > The validation parser seems to treat any newline as the end of the
> > spec definition for that particular value, and either bombs out
> with a
> > parse error, or returns False upon validation.
> >
> > Any tips? Bug?
>
> Hmm... probably the regular expression matching used in validation
> can't
> handle the newlines. Hopefully adding re.DOTALL to some of the regular
> expressions in validate.py will fix it.
>
> I'm unlikely to be able to get to it for a few weeks - so patches
> (including tests!) welcomed. :-)
>
> All the best,
>
>
> Michael Foord
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ------------------------------------------------------------------------
>
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
|
|
From: David H. <neg...@gm...> - 2009-02-19 19:51:39
|
I have the newline support implemented (with tests).
Would you prefer a diff, or just the validate.py?
cheers,
-hoss
On Wed, Jan 28, 2009 at 18:17, Michael Foord <fuz...@vo...>wrote:
> David Hostetler wrote:
> > I'm having a devil of a time getting validate to allow for the default
> > value of a string check to consist of a string that includes a newline
> > character ('\n'). I've tried several syntactic variants, and nothing
> > is working - the validation fails everytime.
> >
> > E.g.:
> >
> > spec = { u'val': u"string(default='%s')" % ('\n') }
> > cfgdict = {}
> >
> > vtor = validate.Validator()
> > cfg = configobj.ConfigObj(cfgdict, configspec=spec)
> >
> > results = cfg.validate(vtor, preserve_errors=True)
> >
> > In addition to the spec as shown above, I've tried:
> >
> > spec = { u'val': u"string(default='\n')" }
> >
> > spec = { u'val': u""""string(default='
> > ')""" }
> >
> >
> > I even tried putting the spec into a text block and using splitlines()
> > and giving that as the configspec argument (where the text block used
> > the '''<value>''' syntax for multi-line values).
> >
> > No joy.
> >
> > The validation parser seems to treat any newline as the end of the
> > spec definition for that particular value, and either bombs out with a
> > parse error, or returns False upon validation.
> >
> > Any tips? Bug?
>
> Hmm... probably the regular expression matching used in validation can't
> handle the newlines. Hopefully adding re.DOTALL to some of the regular
> expressions in validate.py will fix it.
>
> I'm unlikely to be able to get to it for a few weeks - so patches
> (including tests!) welcomed. :-)
>
> All the best,
>
>
> Michael Foord
>
>
|
|
From: Michael F. <fuz...@vo...> - 2009-02-16 14:29:58
|
mai...@op... wrote:
> Zitat von Michael Foord <fuz...@vo...>:
>
>> Hello Stephan,
>>
>> Can you provide a config file that shows the problem? I'm not willing to
>> download and run a VM image just to diagnose this. Does the config file
>> show the same problem when read from Linux / Windows or Mac OS X ?
>
> i have attached the file
Hmm...
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from configobj import ConfigObj
>>> c = ConfigObj('elisa_0_5_6.conf')
>>> c
ConfigObj({'general': {'version': '0.5.17', 'install_date':
'2008-11-07', 'frontends': "['frontend1']", 'disabled_plugins': '[]',
'database': 'sqlite:/storage/.elisa-0.5/elisa.db'}, 'frontend1':
{'frontend': 'pigment.pigment_frontend:PigmentFrontend', 'theme':
'elisa.plugins.poblesec', 'controller_path': '/poblesec'},
'directories': {'video': "['*default*']", 'pictures': "['*default*']",
'music': "['*default*']"}})
>>> d = open(c.filename).read()
>>> d
"[general]\nversion = '0.5.17'\ninstall_date = '2008-11-07'\nfrontends =
['frontend1']\ndisabled_plugins = []\n# database connection string. see
https://storm.canonical.com/Manual\ndatabase =
'sqlite:/storage/.elisa-0.5/elisa.db'\n\n[frontend1]\nfrontend =
'pigment.pigment_frontend:PigmentFrontend'\ntheme =
'elisa.plugins.poblesec'\ncontroller_path =
'/poblesec'\n\n[directories]\nvideo = ['*default*']\npictures =
['*default*']\nmusic = ['*default*']\n"
>>>
So on Mac OS X I can read the file with ConfigObj fine and the line
endings are '\n' which should be fine on any system. You could repeat
this experiment on the system that shows the problems and see if the
results are the same.
This means that the problem is either with the code using ConfigObj *or*
with the underlying platform.
If you try with ConfigObj(filename, raise_errors=True) then you should
get the full traceback when the first error is hit. This may give a
better idea of what is happening.
All the best,
Michael Foord
>
> stephan
>
>>
>> Michael
>>
>> mai...@op... wrote:
>>> Hi all,
>>>
>>> i have still follow problem (i have written to list last year
>>> http://sourceforge.net/mailarchive/message.php?msg_name=20081118135605.j3stzle65kos8c00%40login-64.hoststar.ch)
>>>
>>>
>>> when i am start elisa with "HOME=/var/log ELISA_DEBUG=5
>>> /usr/bin/elisa" on my self compiled embedded linux distribution i
>>> become error message like this (/storage is now /var/log):
>>>
>>> INFO MainThread application Nov 14 11:56:05
>>> Using config file:
>>> '/storage/.elisa-0.5/elisa_0_5_6.conf' (elisa/core/application.py:202)
>>> DEBUG MainThread config Nov 14 11:56:05
>>> Creating config
>>> '/storage/.elisa-0.5/elisa_0_5_6.conf' (elisa/core/config.py:123)
>>> INFO MainThread config Nov 14
>>> 11:56:05 Using
>>> '/storage/.elisa-0.5/elisa_0_5_6.conf' config file
>>> (elisa/core/config.py:85)
>>> WARN MainThread application Nov 14 11:56:06
>>> Config format error
>>> in /storage/.elisa-0.5/elisa_0_5_6.conf: Parse error in value at line
>>> 2.;Parse error in
>>> value at line 3.;Parse error in value at line 4.;Parse error in value
>>> at line 5.;Parse
>>> error in value at line 7.;Parse error in value at line 10.;Parse error
>>> in value at line
>>> 11.;Parse error in value at line 12.;Parse error in value at line
>>> 15.;Parse error in
>>> value at line 16.;Parse error in value at line 17.
>>> (elisa/core/application.py:211)
>>> LOG MainThread logobserver Nov 14
>>> 11:56:06 Failure
>>>
>>> my /var/log is read/writeable and the configfile will be created
>>> and is valid.
>>>
>>> i dont know where is the problem, can you help me to find the error?
>>>
>>> you can download a qemu image of the distribution (ca 31MB) from
>>> http://sources.openelec.tv/OpenELEC.bin.tar.bz2
>>>
>>> start this - if you have qemu installed - with ./start.sh and it will
>>> boot. then you have Xorg with a minimal terminal. When you set
>>> HOME=/var/log you can loopmount the image and you can work with elisas
>>> configfile. when you have questions or need additional software to
>>> debug write me to list.
>>>
>>> i hope we can find the error
>>>
>>> Stephan
>>>
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>>
>>> Open Source Business Conference (OSBC), March 24-25, 2009, San
>>> Francisco, CA
>>> -OSBC tackles the biggest issue in open source: Open Sourcing the
>>> Enterprise
>>> -Strategies to boost innovation and cut costs with open source
>>> participation
>>> -Receive a $600 discount off the registration fee with the source
>>> code: SFAD
>>> http://p.sf.net/sfu/XcvMzF8H
>>> _______________________________________________
>>> Configobj-develop mailing list
>>> Con...@li...
>>> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>>>
>>
>>
>> --
>> http://www.ironpythoninaction.com/
>> http://www.voidspace.org.uk/blog
>>
>>
>>
>> ------------------------------------------------------------------------------
>>
>> Open Source Business Conference (OSBC), March 24-25, 2009, San
>> Francisco, CA
>> -OSBC tackles the biggest issue in open source: Open Sourcing the
>> Enterprise
>> -Strategies to boost innovation and cut costs with open source
>> participation
>> -Receive a $600 discount off the registration fee with the source
>> code: SFAD
>> http://p.sf.net/sfu/XcvMzF8H
>> _______________________________________________
>> Configobj-develop mailing list
>> Con...@li...
>> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>>
>>
>
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ------------------------------------------------------------------------
>
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
|
|
From: <mai...@op...> - 2009-02-16 11:12:55
|
Zitat von Michael Foord <fuz...@vo...>: > Hello Stephan, > > Can you provide a config file that shows the problem? I'm not willing to > download and run a VM image just to diagnose this. Does the config file > show the same problem when read from Linux / Windows or Mac OS X ? i have attached the file stephan > > Michael > > mai...@op... wrote: >> Hi all, >> >> i have still follow problem (i have written to list last year >> http://sourceforge.net/mailarchive/message.php?msg_name=20081118135605.j3stzle65kos8c00%40login-64.hoststar.ch) >> >> when i am start elisa with "HOME=/var/log ELISA_DEBUG=5 >> /usr/bin/elisa" on my self compiled embedded linux distribution i >> become error message like this (/storage is now /var/log): >> >> INFO MainThread application Nov 14 11:56:05 >> Using config file: >> '/storage/.elisa-0.5/elisa_0_5_6.conf' (elisa/core/application.py:202) >> DEBUG MainThread config Nov 14 11:56:05 >> Creating config >> '/storage/.elisa-0.5/elisa_0_5_6.conf' (elisa/core/config.py:123) >> INFO MainThread config Nov 14 11:56:05 Using >> '/storage/.elisa-0.5/elisa_0_5_6.conf' config file (elisa/core/config.py:85) >> WARN MainThread application Nov 14 11:56:06 >> Config format error >> in /storage/.elisa-0.5/elisa_0_5_6.conf: Parse error in value at line >> 2.;Parse error in >> value at line 3.;Parse error in value at line 4.;Parse error in value >> at line 5.;Parse >> error in value at line 7.;Parse error in value at line 10.;Parse error >> in value at line >> 11.;Parse error in value at line 12.;Parse error in value at line >> 15.;Parse error in >> value at line 16.;Parse error in value at line 17. >> (elisa/core/application.py:211) >> LOG MainThread logobserver Nov 14 >> 11:56:06 Failure >> >> my /var/log is read/writeable and the configfile will be created >> and is valid. >> >> i dont know where is the problem, can you help me to find the error? >> >> you can download a qemu image of the distribution (ca 31MB) from >> http://sources.openelec.tv/OpenELEC.bin.tar.bz2 >> >> start this - if you have qemu installed - with ./start.sh and it will >> boot. then you have Xorg with a minimal terminal. When you set >> HOME=/var/log you can loopmount the image and you can work with elisas >> configfile. when you have questions or need additional software to >> debug write me to list. >> >> i hope we can find the error >> >> Stephan >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA >> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise >> -Strategies to boost innovation and cut costs with open source participation >> -Receive a $600 discount off the registration fee with the source code: SFAD >> http://p.sf.net/sfu/XcvMzF8H >> _______________________________________________ >> Configobj-develop mailing list >> Con...@li... >> https://lists.sourceforge.net/lists/listinfo/configobj-develop >> > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > > |
|
From: Michael F. <fuz...@vo...> - 2009-02-15 22:56:50
|
Hello Stephan, Can you provide a config file that shows the problem? I'm not willing to download and run a VM image just to diagnose this. Does the config file show the same problem when read from Linux / Windows or Mac OS X ? Michael mai...@op... wrote: > Hi all, > > i have still follow problem (i have written to list last year > http://sourceforge.net/mailarchive/message.php?msg_name=20081118135605.j3stzle65kos8c00%40login-64.hoststar.ch) > > when i am start elisa with "HOME=/var/log ELISA_DEBUG=5 > /usr/bin/elisa" on my self compiled embedded linux distribution i > become error message like this (/storage is now /var/log): > > INFO MainThread application Nov 14 11:56:05 > Using config file: > '/storage/.elisa-0.5/elisa_0_5_6.conf' (elisa/core/application.py:202) > DEBUG MainThread config Nov 14 11:56:05 > Creating config > '/storage/.elisa-0.5/elisa_0_5_6.conf' (elisa/core/config.py:123) > INFO MainThread config Nov 14 11:56:05 Using > '/storage/.elisa-0.5/elisa_0_5_6.conf' config file (elisa/core/config.py:85) > WARN MainThread application Nov 14 11:56:06 > Config format error > in /storage/.elisa-0.5/elisa_0_5_6.conf: Parse error in value at line > 2.;Parse error in > value at line 3.;Parse error in value at line 4.;Parse error in value > at line 5.;Parse > error in value at line 7.;Parse error in value at line 10.;Parse error > in value at line > 11.;Parse error in value at line 12.;Parse error in value at line > 15.;Parse error in > value at line 16.;Parse error in value at line 17. > (elisa/core/application.py:211) > LOG MainThread logobserver Nov 14 11:56:06 Failure > > my /var/log is read/writeable and the configfile will be created and is valid. > > i dont know where is the problem, can you help me to find the error? > > you can download a qemu image of the distribution (ca 31MB) from > http://sources.openelec.tv/OpenELEC.bin.tar.bz2 > > start this - if you have qemu installed - with ./start.sh and it will > boot. then you have Xorg with a minimal terminal. When you set > HOME=/var/log you can loopmount the image and you can work with elisas > configfile. when you have questions or need additional software to > debug write me to list. > > i hope we can find the error > > Stephan > > > > > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog |
|
From: <mai...@op...> - 2009-02-15 22:52:09
|
Hi all, i have still follow problem (i have written to list last year http://sourceforge.net/mailarchive/message.php?msg_name=20081118135605.j3stzle65kos8c00%40login-64.hoststar.ch) when i am start elisa with "HOME=/var/log ELISA_DEBUG=5 /usr/bin/elisa" on my self compiled embedded linux distribution i become error message like this (/storage is now /var/log): INFO MainThread application Nov 14 11:56:05 Using config file: '/storage/.elisa-0.5/elisa_0_5_6.conf' (elisa/core/application.py:202) DEBUG MainThread config Nov 14 11:56:05 Creating config '/storage/.elisa-0.5/elisa_0_5_6.conf' (elisa/core/config.py:123) INFO MainThread config Nov 14 11:56:05 Using '/storage/.elisa-0.5/elisa_0_5_6.conf' config file (elisa/core/config.py:85) WARN MainThread application Nov 14 11:56:06 Config format error in /storage/.elisa-0.5/elisa_0_5_6.conf: Parse error in value at line 2.;Parse error in value at line 3.;Parse error in value at line 4.;Parse error in value at line 5.;Parse error in value at line 7.;Parse error in value at line 10.;Parse error in value at line 11.;Parse error in value at line 12.;Parse error in value at line 15.;Parse error in value at line 16.;Parse error in value at line 17. (elisa/core/application.py:211) LOG MainThread logobserver Nov 14 11:56:06 Failure my /var/log is read/writeable and the configfile will be created and is valid. i dont know where is the problem, can you help me to find the error? you can download a qemu image of the distribution (ca 31MB) from http://sources.openelec.tv/OpenELEC.bin.tar.bz2 start this - if you have qemu installed - with ./start.sh and it will boot. then you have Xorg with a minimal terminal. When you set HOME=/var/log you can loopmount the image and you can work with elisas configfile. when you have questions or need additional software to debug write me to list. i hope we can find the error Stephan |
|
From: Sam's L. <sam...@gm...> - 2009-02-06 07:47:58
|
I've just started with ConfigObj, and I already like it so much better than ConfigParser. One thing I do a lot of is allowing configuration options in either a config file or on the command line. ConfigParser and OptParse intergate together really well. Is there a preferred options package and a preferred way of integrating config files and command line options with ConfigObj? Thanks. |
|
From: David H. <neg...@gm...> - 2009-01-28 23:21:56
|
> Hmm... probably the regular expression matching used in validation can't > handle the newlines. Hopefully adding re.DOTALL to some of the regular > expressions in validate.py will fix it. > > I'm unlikely to be able to get to it for a few weeks - so patches > (including tests!) welcomed. :-) > > All the best, > > > Michael Foord Roger that. Thanks for the quick reply. - David |
|
From: Michael F. <fuz...@vo...> - 2009-01-28 23:17:43
|
David Hostetler wrote:
> I'm having a devil of a time getting validate to allow for the default
> value of a string check to consist of a string that includes a newline
> character ('\n'). I've tried several syntactic variants, and nothing
> is working - the validation fails everytime.
>
> E.g.:
>
> spec = { u'val': u"string(default='%s')" % ('\n') }
> cfgdict = {}
>
> vtor = validate.Validator()
> cfg = configobj.ConfigObj(cfgdict, configspec=spec)
>
> results = cfg.validate(vtor, preserve_errors=True)
>
> In addition to the spec as shown above, I've tried:
>
> spec = { u'val': u"string(default='\n')" }
>
> spec = { u'val': u""""string(default='
> ')""" }
>
>
> I even tried putting the spec into a text block and using splitlines()
> and giving that as the configspec argument (where the text block used
> the '''<value>''' syntax for multi-line values).
>
> No joy.
>
> The validation parser seems to treat any newline as the end of the
> spec definition for that particular value, and either bombs out with a
> parse error, or returns False upon validation.
>
> Any tips? Bug?
Hmm... probably the regular expression matching used in validation can't
handle the newlines. Hopefully adding re.DOTALL to some of the regular
expressions in validate.py will fix it.
I'm unlikely to be able to get to it for a few weeks - so patches
(including tests!) welcomed. :-)
All the best,
Michael Foord
>
> thanks,
>
> - David Hostetler
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> ------------------------------------------------------------------------
>
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
|
|
From: David H. <neg...@gm...> - 2009-01-28 23:13:32
|
I'm having a devil of a time getting validate to allow for the default value
of a string check to consist of a string that includes a newline character
('\n'). I've tried several syntactic variants, and nothing is working - the
validation fails everytime.
E.g.:
spec = { u'val': u"string(default='%s')" % ('\n') }
cfgdict = {}
vtor = validate.Validator()
cfg = configobj.ConfigObj(cfgdict, configspec=spec)
results = cfg.validate(vtor, preserve_errors=True)
In addition to the spec as shown above, I've tried:
spec = { u'val': u"string(default='\n')" }
spec = { u'val': u""""string(default='
')""" }
I even tried putting the spec into a text block and using splitlines() and
giving that as the configspec argument (where the text block used the
'''<value>''' syntax for multi-line values).
No joy.
The validation parser seems to treat any newline as the end of the spec
definition for that particular value, and either bombs out with a parse
error, or returns False upon validation.
Any tips? Bug?
thanks,
- David Hostetler
|
|
From: Michael F. <fuz...@vo...> - 2009-01-16 14:55:25
|
Jeffrey Barish wrote:
> On Friday 16 January 2009 04:07:43 Michael Foord wrote:
>
>> Jeffrey Barish wrote:
>>
>>> On Monday 12 January 2009 08:16:57 Michael Foord wrote:
>>>
>>>> Jeffrey Barish wrote:
>>>>
>>>>> I write the repr of a tuple to my configuration file on exit. Usually,
>>>>> I find "<tuple>" in my configuration file afterward, but occasionally
>>>>> the quotation marks are missing. I have not been able to detect a
>>>>> pattern. Any suggestions?
>>>>>
>>>> Is it actually causing any problems?
>>>>
>>> Or worse: If the value in the configuration file is
>>>
>>> ('a', ['b', 'c'])
>>>
>>> then I get a ParseError (at line 8) when I try to read it. That error I
>>> cannot fix.
>>>
>>> BTW, I am using version 4.5.3.
>>>
>> Did you have any luck reproducing this?
>>
>> Michael
>>
>
> Not really. The problem occurs only on one platform (maemo) when I interrupt
> the program (^c). I circumvented the problem by catching the SIGINT so that
> I can write the configuration file. I do not understand why configobj
> otherwise writes the right data but without the quotes nor why on another
> platform it writes exactly the right data including the quotes. In fact, I
> don't really understand why it writes anything as the program is exiting.
> There could be an issue with my program, but since the program is exiting
> anyway, I am satisfied with my remedy.
>
>
Interesting. It shouldn't be possible for this to happen (of course) -
it possibly happens as a result of code execution during the exception
handling of the KeyboardInterrupt (?).
Unfortunately I don't have access to maemo to test this. :-) Which of
course is a great excuse to not do anything about it.
There is no exception handling code in the write method of ConfigObj and
it only writes to the file once it has built the text representation as
a string. In other words *I* can't see how this could happen I'm afraid. :-(
If you do find any cause in ConfigObj for this problem I'd be happy to
explore workarounds and alternatives.
Michael Foord
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
|