The line https://github.com/mineo/mb2wikidatabot/blob/master/bot/const.py#L36 sometimes causes the whole python interpreter to block, so it doesn't even exit on ^C anymore. Since this might be a very specific problem related to the order things are imported in etc., here's a rough overview of how that line is reached.
https://github.com/mineo/mb2wikidatabot/blob/master/run.py is the main entry point of the bot, which imports
https://github.com/mineo/mb2wikidatabot/blob/master/bot/common.py, which (in line 8) imports the const.py file.
I've added print statements around every statement in const.py and the one before the creation of the ItemPage is the last one that gets executed.
I have now found a reliable way to fix this and that is the execution of a file that contains only the following code (yes, this is basically a variation of the const.py file):
import pywikibot as wp
WIKIDATA = wp.Site('wikidata', 'wikidata')
WIKIDATA_DATASITE = WIKIDATA.data_repository()
MUSICBRAINZ_WIKIDATAPAGE = wp.ItemPage(WIKIDATA_DATASITE, "Q14005")
MUSICBRAINZ_CLAIM = wp.Claim(WIKIDATA_DATASITE, "P248")Other ways to fix it include deletions of most files in the pywikibot user directory and/or random invokations of pywikibots scripts/login.py script.
This happens on Python 2.6.5 on Ubuntu 10.04.4 in a virtual environment. This has happened over the last few year every once in a while with different revisions of pywikibot, but I feel like it's now happening way more often. The currently used pywikibot version is 6b2e416b1bd67d16cf70f3c02420bd9124217a13.