[Moin-user] Problems migrating
p.f.moore at gmail.com
Wed Jan 9 06:22:46 EST 2008
On 09/01/2008, Paul Moore <p.f.moore at gmail.com> wrote:
> On 09/01/2008, Thomas Waldmann <tw-public at gmx.de> wrote:
> > > PAGE|SQL_Scripts|SQL Scripts
> > That's OK.
> > But your problem seems to be a damaged event-log.
> > If you can live without statistics, you can simple truncate it to 0
> > bytes. Otherwise open it with an editor and search for a line not
> > consisting of 3 items timestamp, action, kvpairs.
> Ah, I wondered if it might be that, but I wasn't sufficiently sure
> that I'd read the traceback correctly. The event log information isn't
> critical to me, so I'll manually tidy it up.
> As a suggestion, would it be worth trapping the error and returning a
> custom error message "Event log for page xxx appears corrupt"?
> Offering to ignore the corrupt data may be helpful as well. If you
> like the idea, and I get the time, I'll see if I can put together a
The following patch reports the line number and file name when a
corruption is found. With this, I was able to locate and correct the
offending line in my event log, and have now managed a successful
Feel free to use the patch if you would like to.
Thanks for the help!
--- _conv160.py.orig 2007-12-23 21:56:48.000000000 +0000
+++ _conv160.py 2008-01-09 11:02:39.749019800 +0000
@@ -78,14 +78,20 @@
""" read complete event-log from disk """
data = 
+ lineno = 0
f = file(self.fname, 'r')
for line in f:
+ lineno = lineno + 1
line = line.replace('\r', '').replace('\n', '')
if not line.strip(): # skip empty lines
fields = line.split('\t')
- timestamp, action, kvpairs = fields[:3]
- timestamp = int(timestamp)
+ timestamp, action, kvpairs = fields[:3]
+ timestamp = int(timestamp)
+ except ValueError, err:
+ # Corrupt event log - give the user a better message
+ raise ValueError("Event log '%s' line %d is
corrupt" % (self.fname, lineno))
kvdict = wikiutil.parseQueryString(kvpairs)
data.append((timestamp, action, kvdict))
More information about the Moin-user