Unhandled TypeError when ibus is restarted
Incredibly minor issue. When you run the ibus-engine-cangjie directly in terminal then restart ibus elsewhere, this is the message you get:
Traceback (most recent call last):
File "/usr/lib/ibus-cangjie/ibus-engine-cangjie", line 77, in <module>
IMApp(args.ibus, args.engine, componentdir).run()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/ibus_cangjie/__init__.py", line 48, in __init__
self.__factory = IBus.Factory.new(self.__bus.get_connection())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Argument 0 does not allow None as a value
This happens probably because the IBus.MainLoop implementation, after the ibus restart, would try to restart a new thread and run the init again. In that case, the get_connection()
method would return None
(ibus is down). This is invisible to most user. But for a developer, I feel like we should give the process a better ending (wink).