Python COM and Threads

O

Olaf Meding

Looks like Python can not make COM calls from a thread? Here is the
error message I get: 'CoInitialize has not been called.'

Here is the code:

import threading
import win32com.client

class Thread1(threading.Thread):
def run(self):
print 'thread 1'
userInterface = win32com.client.Dispatch('Excel.Application')

def main():
t1 = Thread1()
t1.start()

if __name__ == '__main__':
main()


Thanks much for your help on this.

Olaf
 
I

Irmen de Jong

Olaf said:
Looks like Python can not make COM calls from a thread? Here is the
error message I get: 'CoInitialize has not been called.'

So.. call CoInitialize !?

(and CoUninitialize)

--Irmen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top