|
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
|