Hi, I'm fairly new to Python COM development and I'm having trouble automating Microsoft Excel. I have the following piece of code:
d = win32com.client.Dispatch('Excel.Application') d.Visible = 1 dw = d.Workbooks.Open('c:\\datos.xls') dw.Sheets(1).Select() Normally it runs great, and after these four lines I can begin crunching lots of numbers. There are many times, however, that the code fails in the last line or other lines throughout the code such as: dw.Activate() The error is almost always on the lines of: "bool object is not callable". The randomness of this kind of failure, coupled with the fact that if I add a call to time.sleep() before the line that triggers the error prevents it from happening (prevents better the bigger the sleep, but I can't just wait half a minute for each row of data that I want to read, there are too many of them...) led me to think that it was some sort of race condition, but my program is single-threaded at the moment :-( Is there something that I'm missing? Thank you. BTW, I'm using Python 2.5 with PyWin 210 and MS Office XP/2003, if that helps. _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32