Hello-- A couple of weeks ago, an IDE error caused some minor damage to my Data.fs file. Unfortunately, there had been some significant changes to that file since the previous weekly backup, so I did not want to restore from backup. I used the fsrecover.py utility to recover the damaged Data.fs with great results. A few folders inside Data.fs did have problems, but all of them were corrected by exporting and importing the damaged folder and just re-importing it . . . except for one. With this one folder, I get a POSKeyError. After researching this problem online, I used the fsrefs.py utility to determine which object it is that's not being found, but I can't figure out how to either a) get that object back (since I can't access the management screens due to the error) or b) remove the invalid references. I have seen some references to truncating (a copy of) the Data.fs just before the transaction that causes the error, but I haven't found any instructions on how to do this. So, is there any good way to fix this by either replacing the object or deleting the invalid transaction? Thanks, Jeremy. -- Jeremy M. Smith <jeremy@ucdavis.edu> Computer Systems Administrator Center for Mind and Brain University of California, Davis
Jeremy M. Smith wrote at 2003-5-27 15:36 -0700:
... With this one folder, I get a POSKeyError. After researching this problem online, I used the fsrefs.py utility to determine which object it is that's not being found, but I can't figure out how to either a) get that object back (since I can't access the management screens due to the error) or b) remove the invalid references. I have seen some references to truncating (a copy of) the Data.fs just before the transaction that causes the error, but I haven't found any instructions on how to do this.
You know that you can access the ZODB outside of Zope? For this to be possible, you must either stop Zope or use ZEO. It then looks like this (I assume a Unix setup with "bash"; the shell commands are different for Windows): # you are inside your Zope directory export PYTHONPATH=$PYTHONPATH:$PWD/lib/python python from Zope import app root= app() # "root" contains your root object obj= root.unrestrictedTraverse(url_to_obj) # assume, "obj" now contains the folder with the dangling # reference; we must find the id belonging to the reference for id,val in obj.objectItems(): try: val.getId() except POSKeyError: break # "id" should now contain the id with the broken object # we give it a new one obj._setOb(id,DTMLMethod('',__name__=id)) # now we delete it obj.manage_delObject(id) # commit get_transaction().commit() The script is not complete. You must import "POSKeyError" and "DTMLMethod" and provide "url_to_obj". Dieter
Thank you *so* much. Improvising around the code you provided, I was able to delete the errant UserFolder object and re-create it. The POSKeyError is no more. If you don't object, I'd like to create a howto on this topic at one of the Zope sites. I spent two days searching through news archives, Google results, etc. looking for something like this with no luck, though it seems many others have experienced similar errors. Again, thanks. Jeremy. Dieter Maurer wrote:
Jeremy M. Smith wrote at 2003-5-27 15:36 -0700:
... With this one folder, I get a POSKeyError. After researching this problem online, I used the fsrefs.py utility to determine which object it is that's not being found, but I can't figure out how to either a) get that object back (since I can't access the management screens due to the error) or b) remove the invalid references. I have seen some references to truncating (a copy of) the Data.fs just before the transaction that causes the error, but I haven't found any instructions on how to do this.
You know that you can access the ZODB outside of Zope?
For this to be possible, you must either stop Zope or use ZEO.
It then looks like this (I assume a Unix setup with "bash"; the shell commands are different for Windows):
# you are inside your Zope directory export PYTHONPATH=$PYTHONPATH:$PWD/lib/python python from Zope import app root= app() # "root" contains your root object obj= root.unrestrictedTraverse(url_to_obj)
# assume, "obj" now contains the folder with the dangling # reference; we must find the id belonging to the reference for id,val in obj.objectItems(): try: val.getId() except POSKeyError: break # "id" should now contain the id with the broken object # we give it a new one obj._setOb(id,DTMLMethod('',__name__=id)) # now we delete it obj.manage_delObject(id) # commit get_transaction().commit()
The script is not complete. You must import "POSKeyError" and "DTMLMethod" and provide "url_to_obj".
Dieter
-- Jeremy M. Smith <jeremy@ucdavis.edu> Computer Systems Administrator Center for Mind and Brain University of California, Davis
On Wed, May 28, 2003 at 04:11:09PM -0700, Jeremy M. Smith wrote:
Thank you *so* much. Improvising around the code you provided, I was able to delete the errant UserFolder object and re-create it. The POSKeyError is no more. If you don't object, I'd like to create a howto on this topic at one of the Zope sites.
Yes please!!! -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's WEAK COW WOMAN! (random hero from isometric.spaceninja.com)
participants (3)
-
Dieter Maurer -
Jeremy M. Smith -
Paul Winkler