Philantrop / calibre-marvin-manager

A calibre User Interface Action plugin supporting Marvin
6 stars 6 forks source link

MXD crash after changing libraries (filed on behalf of WyndhamMiso) #51

Closed GRiker closed 10 years ago

GRiker commented 10 years ago

Hi Greg,

I apologise, but I broke it…

I installed the new MXD and restarted calibre.

Ran MXD and the resulting window looked good although I did not look closely.

I then closed the MXD window and changed library in calibre – Marvin still connected. Ran MXD and the MXD windows displayed no green books. There were numerous yellow ones, but they were for the previous library. The one that was open in calibre initially in this test.

I then selected all the yellow books and chose to refresh custom columns (which is disabled for automatic update in MXD settings).

The following error came up. I notice the debug log references a file on a c: drive that is not part of either calibre or MXD installation. It may be this is the culprit. …

Regards,

Wyndham

calibre, version 1.36.0

ERROR: Unhandled exception: ConstraintError:ConstraintError: Foreign key violation: book not in books

calibre 1.36 [64bit] isfrozen: True is64bit: True

Windows-7-6.1.7601-SP1 Windows ('64bit', 'WindowsPE')

('Windows', '7', '6.1.7601')

Python 2.7.5

Windows: ('7', '6.1.7601', 'SP1', 'Multiprocessor Free')

Traceback (most recent call last):

File "calibre_plugins.marvin_manager.book_status", line 1076, in dispatch_button_click

File "calibre_plugins.marvin_manager.book_status", line 1527, in refresh_custom_columns

File "calibre_plugins.marvin_manager.book_status", line 2501, in _apply_progress

File "site-packages\calibre\db\legacy.py", line 465, in set_metadata

File "site-packages\calibre\db\cache.py", line 57, in call_func_with_lock

File "site-packages\calibre\db\cache.py", line 1223, in set_metadata

File "site-packages\calibre\db\cache.py", line 1165, in protected_set_field

File "site-packages\calibre\db\cache.py", line 1145, in set_field

File "site-packages\calibre\db\cache.py", line 963, in set_field

File "site-packages\calibre\db\write.py", line 513, in set_books

File "site-packages\calibre\db\write.py", line 205, in one_one_in_other

File "site-packages\calibre\db\backend.py", line 804, in executemany

File "c:\cygwin\home\kovid\sw\build\apsw-3.7.14.1-r1\src\cursor.c", line 231, in resetcursor

ConstraintError: ConstraintError: Foreign key violation: book not in books

WyndhamMisio commented 10 years ago

After I clicked on Okay, tjhis error came up.

I suspect it is because I had disconnected my iPad (and Marvin), forgetting the calibre connection was still open.

I include this just for completeness sake. Perhaps there is a way to catch this and close with a nolrmal message rather than an error - even if I had been stupid...

calibre, version 1.36.0 ERROR: Unhandled exception: AttributeError:'NoneType' object has no attribute 'device_name'

calibre 1.36 [64bit] isfrozen: True is64bit: True Windows-7-6.1.7601-SP1 Windows ('64bit', 'WindowsPE') ('Windows', '7', '6.1.7601') Python 2.7.5 Windows: ('7', '6.1.7601', 'SP1', 'Multiprocessor Free') Traceback (most recent call last): File "calibre_plugins.marvin_manager.action", line 1660, in main_menu_button_clicked File "calibre_plugins.marvin_manager.action", line 2654, in show_installed_books File "calibre_plugins.marvin_manager.action", line 1993, in profile_db AttributeError: 'NoneType' object has no attribute 'device_name'

GRiker commented 10 years ago

I've added some code that should prevent that device_name error. Download and install an updated MXD from this link.

The initial error report seems a likely suspect in MXD losing its bearings.

Could you please try this:

If this seems to work as expected, try repeating the steps when you first encountered the error, when you left Marvin connected while switching libraries. If you're seeing the same error and faulty display, that's a huge step toward resolving this problem.

GRiker commented 10 years ago

If you were having trouble with the version from the link I gave you, please download it again.

GRiker commented 10 years ago

Wyndham, I added some additional code to clear out previous information when changing libraries while Marvin is still connected. Please give it a try when you have a chance. Download/install from this link.

GRiker commented 10 years ago

The prerelease version of MXD can be downloaded from this link.

This should resolve the problem of MXD losing track of the match quality colors.

WyndhamMisio commented 10 years ago

Hi Greg,

Subsequent to this email, you sent out another one with links. Which one should I use?

Regards,

Wyndham

From: GRiker [mailto:notifications@github.com] Sent: 14 May 2014 20:39 To: GRiker/calibre-marvin-manager Cc: WyndhamMisio Subject: Re: [calibre-marvin-manager] MXD crash after changing libraries (filed on behalf of WyndhamMiso) (#51)

Wyndham, I added some additional code to clear out previous information when changing libraries while Marvin is still connected. Please give it a try when you have a chance. Download/install from this link https://www.dropbox.com/s/six0c50asmvkjm8/Marvin%20XD.zip .

— Reply to this email directly or view it on GitHub https://github.com/GRiker/calibre-marvin-manager/issues/51#issuecomment-43127289 . https://github.com/notifications/beacon/5481159__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNTcxNTUxMCwiZGF0YSI6eyJpZCI6MzIyMjk1MTF9fQ==--45830aae885da2db032031d5ef8ce42c56673186.gif

GRiker commented 10 years ago

They're all the same. Use the one from this issue just above your previous comment.

WyndhamMisio commented 10 years ago

Greg,

I followed the steps, downloaded and installed the latest plugin, reset the caches (useful that…), exited and then ran calibre, and ran MXD after initialisation had completed. The colours displayed looked correct.

I then stopped the MXD connector, and changed the calibre library (to the other one with books in Marvin), re-started the MXD connector in Marvin, and ran MXD (after initialisation had completed).

Unfortunately we are back to six green books, and four yellows – the same as we had before. **

Without disconnecting, I closed the MXD window, cleared the caches, and ran MXD again. This time the colours are correct.

Closed the MXD window, disconnected MXD, changed back to the first library (the other one which has books in Marvin), started the MXD connector, and then ran MXD (when calibre was ready), and the colours look correct.

Close MXD window, disconnect MXD, change back to second library in calibre (the one that showed the six green books last time), started the MXD connector, and when calibre was ready, ran MXD. The colours are good. I’ve no idea why they were wrong the first time see \ above (6 green and 4 yellow)

All of the above steps were carried out using my iPad and the All My Books collection showing in Marvin. Apart from the first time when the caches were cleared, calibre stayed running.

Regards,

Wyndham

From: GRiker [mailto:notifications@github.com] Sent: 14 May 2014 19:10 To: GRiker/calibre-marvin-manager Cc: WyndhamMisio Subject: Re: [calibre-marvin-manager] MXD crash after changing libraries (filed on behalf of WyndhamMiso) (#51)

I've added some code that should prevent that device_name error. Download and install MXD from this link https://www.dropbox.com/s/six0c50asmvkjm8/Marvin%20XD.zip

The initial error report seems like a likely suspect in MXD losing its bearings.

Could you please try this:

If this seems to work as expected, try repeating the steps when you first encountered the error, when you left Marvin connected while switching libraries. If you're seeing the same error and faulty display, that's a huge step toward resolving this problem.

— Reply to this email directly or view it on GitHub https://github.com/GRiker/calibre-marvin-manager/issues/51#issuecomment-43116473 . https://github.com/notifications/beacon/5481159__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNTcxMDE4NywiZGF0YSI6eyJpZCI6MzIyMjk1MTF9fQ==--2d093b1d3bbafc3f663a8474597933fa3afbfb5a.gif

GRiker commented 10 years ago

I decided to rethink how I was handling library switching. I've posted a new build which should be an improvement on all fronts. You can download it from this link.

I appreciate your persistence, the bug report you filed yesterday for this issue was the breakthrough I needed to see the problem.

In a nutshell, I'm now keeping separate caches for each library that you connect to. Previously, I was only caching the most recently used library, which was leading to various problems. I also have a stricter test to discover whether or not you've updated metadata in calibre since the last time you ran MXD.

I'm fairly confident that this is the correct approach. Please give your usual thorough testing when you have a chance.

GRiker commented 10 years ago

Wyndham, I've made substantial improvements to how MXD handles switching among multiple libraries. Please update to this link, the same as the other one I posted in the iOSRA 1.4.0 prerelease issue. Assuming that everything works as expected, it's OK to return to your initial settings when you were updating metadata automatically when MXD loads. Try everything you normally would do, let me know of any issues.

WyndhamMisio commented 10 years ago

Installed latest plugins. Connection went smoothly and seemed reasonably fast. MXD window colours looked good. Updated metadata columns for one book, okay. Selected all books (CTRL-A) and clicked to update metadata columns. After several minutes of updating, this erro appeared.

calibre, version 1.37.0 ERROR: Unhandled exception: UnboundLocalError:local variable 'ts_style' referenced before assignment calibre 1.37 [64bit] isfrozen: True is64bit: True Windows-7-6.1.7601-SP1 Windows ('64bit', 'WindowsPE') ('Windows', '7', '6.1.7601') Python 2.7.5 Windows: ('7', '6.1.7601', 'SP1', 'Multiprocessor Free') Traceback (most recent call last): File "calibre_plugins.marvin_manager.book_status", line 1078, in dispatch_button_click File "calibre_plugins.marvin_manager.book_status", line 1525, in refresh_custom_columns File "calibre_plugins.marvin_manager.book_status", line 3649, in _fetch_annotations File "calibre_plugins.marvin_manager.book_status", line 4478, in _get_formatted_annotations File "calibre_plugins.marvin_manager.annotations_db", line 212, in annotations_to_html File "calibre_plugins.marvin_manager.annotations", line 155, in to_HTML\ UnboundLocalError: local variable 'ts_style' referenced before assignment

GRiker commented 10 years ago

Wyndham, please do the following:

GRiker commented 10 years ago

I've posted an updated prerelease of MXD at this link. It should resolve the error you reported.

Please let me know of any other issues.