[pylucene-dev] Re. Best ways to avoid stomping on existing indexes?
Richie Hindle
richie at entrian.com
Fri Feb 11 08:00:59 PST 2005
[Nick]
> it doesn't seem to throw a Python exception, at least on Windows. It
> exits with a MSVC++ runtime error, which I'm guessing I can't catch.
[Andi]
> I think you found a bug, could you please send a bug report with a piece of
> code that reproduces the problem ?
Here's a small piece of code that nine times out of ten quits with a
Microsoft Runtime error box rather than an exception:
-- 8< -- 8< --
import os, shutil
from PyLucene import *
INDEX_DIR = "__TEST__"
# Remove any index left over from a previous test.
if os.path.exists(INDEX_DIR):
shutil.rmtree(INDEX_DIR)
# Create an empty index.
store = FSDirectory.getDirectory(INDEX_DIR, True)
writer = IndexWriter(store, WhitespaceAnalyzer(), True)
writer.close()
# Try to delete a non-existent document.
reader = IndexReader.open(store)
reader.deleteDocument(0)
I'm running Python 2.4 on Windows XP with the binary build of PyLucene
0.9.7.
-- 8< -- 8< --
I'm seeing this kind of thing a lot as I'm developing my app - always when
I've made a mistake, like trying to delete a non-existent document, but
almost every time I make such a mistake I get a hard crash rather than an
exception.
--
Richie Hindle
richie at entrian.com
More information about the pylucene-dev
mailing list