Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rebuild_index fails on windows #96

Closed
gregmuellegger opened this issue May 14, 2012 · 3 comments
Closed

rebuild_index fails on windows #96

gregmuellegger opened this issue May 14, 2012 · 3 comments

Comments

@gregmuellegger
Copy link

Hi, I tried to use xapian with django haystack on windows.

If I try a rebuild_index I get the following:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    run(settings)
  File "manage.py", line 18, in run
    execute_manager(settings)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
459, in execute_manager
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 196,
 in run_from_argv
    self.execute(*args, **options.__dict__)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 232,
 in execute
    output = self.handle(*args, **options)
  File "C:\Users\Frank\Documents\SVN_Frank\geitmann.de\web\third-party\haystack\
management\commands\rebuild_index.py", line 14, in handle
    call_command('clear_index', **options)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
150, in call_command
    return klass.execute(*args, **defaults)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 232,
 in execute
    output = self.handle(*args, **options)
  File "C:\Users\Frank\Documents\SVN_Frank\geitmann.de\web\third-party\haystack\
management\commands\clear_index.py", line 41, in handle
    backend.clear()
  File "C:\Users\Frank\Documents\SVN_Frank\geitmann.de\web\third-party\xapian_ba
ckend.py", line 312, in clear
    shutil.rmtree(self.path)
  File "C:\Python27\lib\shutil.py", line 250, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "C:\Python27\lib\shutil.py", line 248, in rmtree
    os.remove(fullname)
WindowsError: [Error 32] Der Prozess kann nicht auf die Datei zugreifen, da sie
von einem anderen Prozess verwendet wird: 'C:\\Users\\Frank\\Documents\\SVN_Fran
k\\geitmann.de\\web\\xapian_index\\

The german message means something like "The process cannot access the file because it's used by another process."
The rebuild_index works if we replace the first line of the def clear() method with a return :-)

So I assume, removing the directory while the library holds the lock fails under windows. Maybe releasing the lock first would help, or to avoid removing the whole directory.

@notanumber
Copy link
Owner

Does this happen every time you try to rebuild the index or was there by chance an update happening at the same time?

@gregmuellegger
Copy link
Author

Yes, this happens everytime. It is a local development installation,
no cronjobs or anything were accessing the project.

2012/5/29 David Sauve
reply@reply.github.com:

Does this happen every time you try to rebuild the index or was there by chance an update happening at the same time?


Reply to this email directly or view it on GitHub:
#96 (comment)

notanumber added a commit that referenced this issue Jun 5, 2012
…ee. Only do so when required. Should fix issue GH-96.
@notanumber
Copy link
Owner

Should be resolved in SHA 37add92. Will not attempt to establish a WritableDatabase connection prior to shutil.rmtree. Will now only do so if cherry picking documents to remove.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants