Python 2.1, COM (Excel), and Threads...
Adam Karpierz
karpierz at _NOSPAM_alpha.pl
Thu Oct 31 14:16:17 EST 2002
Uzytkownik "Stephen" <stephen.tubbs at paretopartners.com> napisal:
[...]
> from threading import Thread
>
> class foo:
> def run(self):
> try:
> import win32com.client
# You have to use pythoncom.CoInitialize and pythoncom.CoUninitialize eg.:
import pythoncom
pythoncom.CoInitialize()
> self.excel = win32com.client.Dispatch("Excel.Application")
pythoncom.CoUninitialize()
> self.excel.Visible = 1
> k = self.excel.Workbooks.Add()
> v = k.Worksheets(1)
> v.Cells(1,1).Value = str(self)
> except:
> import traceback
> traceback.print_exc()
Cheers
Adam Karpierz
karpierz at zope.pl
More information about the Python-list
mailing list