Project

General

Profile

Actions

Bug #2563

closed

exception: "marshalled for a different thread" when using COM

Added by Jim Pulokas about 11 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
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.

Actions #1

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 #2

Updated by Anchi Cheng about 9 years ago

  • Status changed from Assigned to Closed
Actions

Also available in: Atom PDF