If you have activated (use) JS's "Library-Specific Tweaks", you should deactivate them
prior to upgrading Calibre to any version > 3.40.1 so that any Calibre issues you may have are not confused with JS issues, and vice-versa.
After upgrading Calibre, and all else seems to be working, you may then safely re-activate the "Library-Specific Tweaks" and restart Calibre as normal.
Added:
Important: if you are reading this because you upgraded Calibre to the "new" version > 3.40.1 but did
not deactivate the Tweaks shown below
before upgrading, and
Calibre now fails to start up:
Simply edit the 'Job Spy.json' file located in your /calibre/config/plugins/ directory in a text editor. Change the "True" to "False" for the identifiers in all-capital letters shown below. Restart Calibre.
Code:
"GUI_TOOLS_ACTIVATE_TWEAK_ADD_BOOKS_READ_METADATA_FROM_FILE_CONTENTS_NOT_NAME": "True",
"GUI_TOOLS_ACTIVATE_TWEAK_AUTHOR_SORT_COPY_METHOD": "True",
"GUI_TOOLS_ACTIVATE_TWEAK_AUTO_ADD_DIRECTORY_BY_LIBRARY": "True",
"GUI_TOOLS_ACTIVATE_TWEAK_DEFAULT_OUTPUT_FORMAT_BY_LIBRARY": "True",
"GUI_TOOLS_ACTIVATE_TWEAK_READ_METADATA_FROM_FILE": "False",
"GUI_TOOLS_ACTIVATE_TWEAK_SAVE_COVER_SEPARATELY_BY_LIBRARY": "True",
"GUI_TOOLS_ACTIVATE_TWEAK_SAVE_TO_DIRECTORY_BY_LIBRARY": "True",
"GUI_TOOLS_ACTIVATE_TWEAK_SAVE_TO_TEMPLATE_BY_LIBRARY": "True",
"GUI_TOOLS_ACTIVATE_TWEAK_TITLE_SERIES_SORTING_BY_LIBRARY": "True",
DaltonST