Actions
Bug #2563
closedexception: "marshalled for a different thread" when using COM
Start date:
10/18/2013
Due date:
% Done:
0%
Estimated time:
Affected Version:
Appion/Leginon 2.1.0
Show in known bugs:
No
Workaround:
Description
get this message under some circumstances throughout leginon history. see three different forum posts. currently seems to happen with comtypes and when doing GUI type things that interact with the scope or camera.
reason has something to do with multithreaded use of COM. see line in gatan.py related to "COINIT_MULTITHREADED". proabably need similar option with comtypes.
maybe ask Christian about any experience he has had with this.
Updated by Anchi Cheng over 9 years ago
Current error message is "Cannot change thread mode after it is set".
Found that we have to createObject in different ways depending on whether it is a direct call as in pyscope test or from a sub-thread, as in the case of Leginon gui.
# initial COM in multithread mode if not initialized otherwise try: comtypes.CoInitializeEx(comtypes.COINIT_MULTITHREADED) except WindowsError: comtypes.CoInitialize()
Actions