I don't know why your code doesn't work, but if all you need is a message box, you might as well use PyQt5, which is bundled with Sigil 0.9.8 and higher.:
Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtWidgets import QApplication, QMessageBox
def run(bk):
print('Start\n')
app = QApplication(sys.argv)
msg = QMessageBox()
msg.setWindowTitle("QMessageBox demo")
msg.setText("This is a QMessageBox.")
msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
buttonClicked = msg.exec_()
if buttonClicked == QMessageBox.Ok:
print('\nYou clicked OK.')
else:
print('\nYou clicked Cancel.')
print('\nEnd')
return 0
def main():
print('I reached main when I should not have\n')
return -1
if __name__ == "__main__":
sys.exit(main())