2007年07月12日 星期四 19:36
ʹÓÃPythonWinµ÷ÓÃExcel µÄ COM ×é¼þ£¬²¿·Ö³ÌÐòÈçÏ£¬µ«³ÌÐòÓ¦¸ÃûÓÐÎÊÌ⣬ÒòΪÊǽÚÑ¡×ÔÒ»±¾ºÜ¾µäµÄÊé class easyExcel: def __init__(self,filename): self.xlApp = win32com.client.dynamic.Dispatch('Excel.Application') self.filename = filename self.xlBook = self.xlApp.Workbooks.Open(filename) spr = easyExcel('Book2.xls') ÔËÐб¨´íÈçÏ File "D:\mytemp\ch09_excel\exceldemos.py", line 155, in getInvoices spr = easyExcel('Book2.xls') File "D:\mytemp\ch09_excel\exceldemos.py", line 30, in __init__ self.xlBook = self.xlApp.Workbooks.Open(filename) File ">", line 8, in Open com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Office Excel', '\xce\xde\xb7\xa8\xd5\xd2\xb5\xbd\xa1\xb0Book2.xls\xa1\xb1\xa1\xa3\xc7\xeb\xbc\xec\xb2\xe9\xce\xc4\xbc\xfe\xc3\xfb\xb5\xc4\xc6\xb4\xd0\xb4\xa3\xac\xb2\xa2\xbc\xec\xb2\xe9\xce\xc4\xbc\xfe\xce\xbb\xd6\xc3\xca\xc7\xb7\xf1\xd5\xfd\xc8\xb7\xa1\xa3\n\n\xc8\xe7\xb9\xfb\xc4\xfa\xd5\xfd\xca\xd4\xcd\xbc\xb4\xd3\xa1\xb0\xce\xc4\xbc\xfe\xa1\xb1\xb2\xcb\xb5\xa5\xc9\xcf\xd7\xee\xbd\xfc\xca\xb9\xd3\xc3\xb5\xc4\xce\xc4\xbc\xfe\xc1\xd0\xb1\xed\xd6\xd0\xb4\xf2\xbf\xaa\xce\xc4\xbc\xfe\xa3\xac\xc7\xeb\xc8\xb7\xc8\xcf\xce\xc4\xbc\xfe\xce\xb4\xb1\xbb\xd6\xd8\xc3\xfc\xc3\xfb\xa1\xa2\xd2\xc6\xb6\xaf\xbb\xf2\xc9\xbe\xb3\xfd\xa1\xa3', 'C:\\Program Files\\Microsoft Office\\OFFICE11\\2052\\xlmain11.chm', 0, -2146827284), None) Çë½Ì¸ÃÈçºÎ½â¾ö£¿ -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20070712/eb1a9fff/attachment.html
2007年07月12日 星期四 19:44
文件名最好给绝对路径 --------------------------------------- '无法找到"Book2.xls"。请检查文件名的拼写,并检查文件位置是否正确。 如果您正试图从"文件"菜单上最近使用的文件列表中打开文件,请确认文件未被重命名、 移动或删除。' ---------------------------------------- On 7/12/07, 张建轶 <farsoftwind在gmail.com> wrote: > 使用PythonWin调用Excel 的 COM 组件,部分程序如下,但程序应该没有问题,因为是节选自一本很经典的书 > > class easyExcel: > def __init__(self,filename): > self.xlApp = > win32com.client.dynamic.Dispatch('Excel.Application') > self.filename = filename > self.xlBook = self.xlApp.Workbooks.Open(filename) > > > spr = easyExcel('Book2.xls') > > 运行报错如下 > File "D:\mytemp\ch09_excel\exceldemos.py", line 155, in > getInvoices > spr = easyExcel('Book2.xls') > File "D:\mytemp\ch09_excel\exceldemos.py", line 30, in > __init__ > self.xlBook = self.xlApp.Workbooks.Open(filename) > File "> com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Office > Excel', > '\xce\xde\xb7\xa8\xd5\xd2\xb5\xbd\xa1\xb0Book2.xls\xa1\xb1\xa1\xa3\xc7\xeb\xbc\xec\xb2\xe9\xce\xc4\xbc\xfe\xc3\xfb\xb5\xc4\xc6\xb4\xd0\xb4\xa3\xac\xb2\xa2\xbc\xec\xb2\xe9\xce\xc4\xbc\xfe\xce\xbb\xd6\xc3\xca\xc7\xb7\xf1\xd5\xfd\xc8\xb7\xa1\xa3\n\n\xc8\xe7\xb9\xfb\xc4\xfa\xd5\xfd\xca\xd4\xcd\xbc\xb4\xd3\xa1\xb0\xce\xc4\xbc\xfe\xa1\xb1\xb2\xcb\xb5\xa5\xc9\xcf\xd7\xee\xbd\xfc\xca\xb9\xd3\xc3\xb5\xc4\xce\xc4\xbc\xfe\xc1\xd0\xb1\xed\xd6\xd0\xb4\xf2\xbf\xaa\xce\xc4\xbc\xfe\xa3\xac\xc7\xeb\xc8\xb7\xc8\xcf\xce\xc4\xbc\xfe\xce\xb4\xb1\xbb\xd6\xd8\xc3\xfc\xc3\xfb\xa1\xa2\xd2\xc6\xb6\xaf\xbb\xf2\xc9\xbe\xb3\xfd\xa1\xa3', > 'C:\\Program Files\\Microsoft > Office\\OFFICE11\\2052\\xlmain11.chm', 0, -2146827284), > None) > > 请教该如何解决? > > > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to > python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to > python-chinese-request在lists.python.cn > Detail Info: > http://python.cn/mailman/listinfo/python-chinese > >", line 8, in Open
2007年07月12日 星期四 19:57
ллpython zhuang£¬ÎÒÓþø¶Ô·¾¶ÊÔÁËһϣ¬Õý³£ÔËÐС£ µ«¸Õ²ÅÄǸö³ÌÐòÎļþ¿ªÊ¼£¬ÆäʵÎÒÒѾÉ趨·¾¶ÁË import os os.chdir('D:\\mytemp\\ch09_excel') ΪʲôBook2.xls´ò¿ª»á³öÎÊÌâÄØ£¿ÓÐʲô³åÍ»»òÕßÎÒʹÓÃos.chdirÓÐÎÊÌâÂð ÔÚ07-7-12£¬python zhuang <python在zhuangzl.com> дµÀ£º > > ÎļþÃû×îºÃ¸ø¾ø¶Ô·¾¶ > --------------------------------------- > 'ÎÞ·¨ÕÒµ½"Book2.xls"¡£Çë¼ì²éÎļþÃûµÄƴд£¬²¢¼ì²éÎļþλÖÃÊÇ·ñÕýÈ·¡£ > Èç¹ûÄúÕýÊÔͼ´Ó"Îļþ"²Ëµ¥ÉÏ×î½üʹÓõÄÎļþÁбíÖдò¿ªÎļþ£¬ÇëÈ·ÈÏÎļþδ±»ÖØÃüÃû¡¢ > Òƶ¯»òɾ³ý¡£' > ---------------------------------------- > On 7/12/07, ÕŽ¨éó <farsoftwind在gmail.com> wrote: > > ʹÓÃPythonWinµ÷ÓÃExcel µÄ COM ×é¼þ£¬²¿·Ö³ÌÐòÈçÏ£¬µ«³ÌÐòÓ¦¸ÃûÓÐÎÊÌ⣬ÒòΪÊǽÚÑ¡×ÔÒ»±¾ºÜ¾µäµÄÊé > > > > class easyExcel: > > def __init__(self,filename): > > self.xlApp = > > win32com.client.dynamic.Dispatch('Excel.Application') > > self.filename = filename > > self.xlBook = self.xlApp.Workbooks.Open(filename) > > > > > > spr = easyExcel('Book2.xls') > > > > ÔËÐб¨´íÈçÏ > > File "D:\mytemp\ch09_excel\exceldemos.py", line 155, in > > getInvoices > > spr = easyExcel('Book2.xls') > > File "D:\mytemp\ch09_excel\exceldemos.py", line 30, in > > __init__ > > self.xlBook = self.xlApp.Workbooks.Open(filename) > > File "> > com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Office > > Excel', > > > '\xce\xde\xb7\xa8\xd5\xd2\xb5\xbd\xa1\xb0Book2.xls\xa1\xb1\xa1\xa3\xc7\xeb\xbc\xec\xb2\xe9\xce\xc4\xbc\xfe\xc3\xfb\xb5\xc4\xc6\xb4\xd0\xb4\xa3\xac\xb2\xa2\xbc\xec\xb2\xe9\xce\xc4\xbc\xfe\xce\xbb\xd6\xc3\xca\xc7\xb7\xf1\xd5\xfd\xc8\xb7\xa1\xa3\n\n\xc8\xe7\xb9\xfb\xc4\xfa\xd5\xfd\xca\xd4\xcd\xbc\xb4\xd3\xa1\xb0\xce\xc4\xbc\xfe\xa1\xb1\xb2\xcb\xb5\xa5\xc9\xcf\xd7\xee\xbd\xfc\xca\xb9\xd3\xc3\xb5\xc4\xce\xc4\xbc\xfe\xc1\xd0\xb1\xed\xd6\xd0\xb4\xf2\xbf\xaa\xce\xc4\xbc\xfe\xa3\xac\xc7\xeb\xc8\xb7\xc8\xcf\xce\xc4\xbc\xfe\xce\xb4\xb1\xbb\xd6\xd8\xc3\xfc\xc3\xfb\xa1\xa2\xd2\xc6\xb6\xaf\xbb\xf2\xc9\xbe\xb3\xfd\xa1\xa3', > > 'C:\\Program Files\\Microsoft > > Office\\OFFICE11\\2052\\xlmain11.chm', 0, -2146827284), > > None) > > > > Çë½Ì¸ÃÈçºÎ½â¾ö£¿ > > > > > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to > > python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to > > python-chinese-request在lists.python.cn > > Detail Info: > > http://python.cn/mailman/listinfo/python-chinese > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20070712/0f1ef102/attachment-0001.htm >", line 8, in Open
2007年07月12日 星期四 20:15
你的疑问的前提是excel会在python进行的当前目录查找文件,但根据你提供的信息来看,似乎excel并不会这样做 On 7/12/07, 张建轶 <farsoftwind在gmail.com> wrote: > 谢谢python zhuang,我用绝对路径试了一下,正常运行。 > 但刚才那个程序文件开始,其实我已经设定路径了 > > import os > os.chdir('D:\\mytemp\\ch09_excel') > > 为什么Book2.xls打开会出问题呢?有什么冲突或者我使用os.chdir有问题吗 > > 在07-7-12,python zhuang <python在zhuangzl.com> 写道: > > 文件名最好给绝对路径 > > --------------------------------------- > > '无法找到"Book2.xls"。请检查文件名的拼写,并检查文件位置是否正确。 > > 如果您正试图从"文件"菜单上最近使用的文件列表中打开文件,请确认文件未被重命名、 > > 移动或删除。' > > ---------------------------------------- > > On 7/12/07, 张建轶 <farsoftwind在gmail.com> wrote: > > > 使用PythonWin调用Excel 的 COM > 组件,部分程序如下,但程序应该没有问题,因为是节选自一本很经典的书 > > > > > > class easyExcel: > > > def __init__(self,filename): > > > self.xlApp = > > > win32com.client.dynamic.Dispatch('Excel.Application') > > > self.filename = filename > > > self.xlBook = self.xlApp.Workbooks.Open(filename) > > > > > > > > > spr = easyExcel('Book2.xls') > > > > > > 运行报错如下 > > > File "D:\mytemp\ch09_excel\exceldemos.py", line 155, > in > > > getInvoices > > > spr = easyExcel('Book2.xls') > > > File "D:\mytemp\ch09_excel\exceldemos.py", line 30, > in > > > __init__ > > > self.xlBook = self.xlApp.Workbooks.Open(filename) > > > File "> > > com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Office > > > Excel', > > > > '\xce\xde\xb7\xa8\xd5\xd2\xb5\xbd\xa1\xb0Book2.xls\xa1\xb1\xa1\xa3\xc7\xeb\xbc\xec\xb2\xe9\xce\xc4\xbc\xfe\xc3\xfb\xb5\xc4\xc6\xb4\xd0\xb4\xa3\xac\xb2\xa2\xbc\xec\xb2\xe9\xce\xc4\xbc\xfe\xce\xbb\xd6\xc3\xca\xc7\xb7\xf1\xd5\xfd\xc8\xb7\xa1\xa3\n\n\xc8\xe7\xb9\xfb\xc4\xfa\xd5\xfd\xca\xd4\xcd\xbc\xb4\xd3\xa1\xb0\xce\xc4\xbc\xfe\xa1\xb1\xb2\xcb\xb5\xa5\xc9\xcf\xd7\xee\xbd\xfc\xca\xb9\xd3\xc3\xb5\xc4\xce\xc4\xbc\xfe\xc1\xd0\xb1\xed\xd6\xd0\xb4\xf2\xbf\xaa\xce\xc4\xbc\xfe\xa3\xac\xc7\xeb\xc8\xb7\xc8\xcf\xce\xc4\xbc\xfe\xce\xb4\xb1\xbb\xd6\xd8\xc3\xfc\xc3\xfb\xa1\xa2\xd2\xc6\xb6\xaf\xbb\xf2\xc9\xbe\xb3\xfd\xa1\xa3', > > > 'C:\\Program Files\\Microsoft > > > Office\\OFFICE11\\2052\\xlmain11.chm', 0, -2146827284), > > > None) > > > > > > 请教该如何解决? > > > > > > > > > > > > > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese在lists.python.cn > > > Subscribe: send subscribe to > > > python-chinese-request在lists.python.cn > > > Unsubscribe: send unsubscribe to > > > python-chinese-request在lists.python.cn > > > Detail Info: > > > http://python.cn/mailman/listinfo/python-chinese > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to > python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to > python-chinese-request在lists.python.cn > > Detail Info: > http://python.cn/mailman/listinfo/python-chinese > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to > python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to > python-chinese-request在lists.python.cn > Detail Info: > http://python.cn/mailman/listinfo/python-chinese > >", line 8, in Open
2007年07月12日 星期四 21:54
可以 print 出错信息, 中文平台会给出中文错误提示的。 On 7/12/07, python zhuang <python在zhuangzl.com> wrote: > 你的疑问的前提是excel会在python进行的当前目录查找文件,但根据你提供的信息来看,似乎excel并不会这样做 > > On 7/12/07, 张建轶 <farsoftwind在gmail.com> wrote: > > 谢谢python zhuang,我用绝对路径试了一下,正常运行。 > > 但刚才那个程序文件开始,其实我已经设定路径了 > > > > import os > > os.chdir('D:\\mytemp\\ch09_excel') > > > > 为什么Book2.xls打开会出问题呢?有什么冲突或者我使用os.chdir有问题吗 > > > > 在07-7-12,python zhuang <python在zhuangzl.com> 写道: > > > 文件名最好给绝对路径 > > > --------------------------------------- > > > '无法找到"Book2.xls"。请检查文件名的拼写,并检查文件位置是否正确。 > > > 如果您正试图从"文件"菜单上最近使用的文件列表中打开文件,请确认文件未被重命名、 > > > 移动或删除。' > > > ---------------------------------------- > > > On 7/12/07, 张建轶 <farsoftwind在gmail.com> wrote: > > > > 使用PythonWin调用Excel 的 COM > > 组件,部分程序如下,但程序应该没有问题,因为是节选自一本很经典的书 > > > > > > > > class easyExcel: > > > > def __init__(self,filename): > > > > self.xlApp = > > > > win32com.client.dynamic.Dispatch('Excel.Application') > > > > self.filename = filename > > > > self.xlBook = self.xlApp.Workbooks.Open(filename) > > > > > > > > > > > > spr = easyExcel('Book2.xls') > > > > > > > > 运行报错如下 > > > > File "D:\mytemp\ch09_excel\exceldemos.py", line 155, > > in > > > > getInvoices > > > > spr = easyExcel('Book2.xls') > > > > File "D:\mytemp\ch09_excel\exceldemos.py", line 30, > > in > > > > __init__ > > > > self.xlBook = self.xlApp.Workbooks.Open(filename) > > > > File "> > > > com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Office > > > > Excel', > > > > > > '\xce\xde\xb7\xa8\xd5\xd2\xb5\xbd\xa1\xb0Book2.xls\xa1\xb1\xa1\xa3\xc7\xeb\xbc\xec\xb2\xe9\xce\xc4\xbc\xfe\xc3\xfb\xb5\xc4\xc6\xb4\xd0\xb4\xa3\xac\xb2\xa2\xbc\xec\xb2\xe9\xce\xc4\xbc\xfe\xce\xbb\xd6\xc3\xca\xc7\xb7\xf1\xd5\xfd\xc8\xb7\xa1\xa3\n\n\xc8\xe7\xb9\xfb\xc4\xfa\xd5\xfd\xca\xd4\xcd\xbc\xb4\xd3\xa1\xb0\xce\xc4\xbc\xfe\xa1\xb1\xb2\xcb\xb5\xa5\xc9\xcf\xd7\xee\xbd\xfc\xca\xb9\xd3\xc3\xb5\xc4\xce\xc4\xbc\xfe\xc1\xd0\xb1\xed\xd6\xd0\xb4\xf2\xbf\xaa\xce\xc4\xbc\xfe\xa3\xac\xc7\xeb\xc8\xb7\xc8\xcf\xce\xc4\xbc\xfe\xce\xb4\xb1\xbb\xd6\xd8\xc3\xfc\xc3\xfb\xa1\xa2\xd2\xc6\xb6\xaf\xbb\xf2\xc9\xbe\xb3\xfd\xa1\xa3', > > > > 'C:\\Program Files\\Microsoft > > > > Office\\OFFICE11\\2052\\xlmain11.chm', 0, -2146827284), > > > > None) > > > > > > > > 请教该如何解决? > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > python-chinese > > > > Post: send python-chinese在lists.python.cn > > > > Subscribe: send subscribe to > > > > python-chinese-request在lists.python.cn > > > > Unsubscribe: send unsubscribe to > > > > python-chinese-request在lists.python.cn > > > > Detail Info: > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese在lists.python.cn > > > Subscribe: send subscribe to > > python-chinese-request在lists.python.cn > > > Unsubscribe: send unsubscribe to > > python-chinese-request在lists.python.cn > > > Detail Info: > > http://python.cn/mailman/listinfo/python-chinese > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to > > python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to > > python-chinese-request在lists.python.cn > > Detail Info: > > http://python.cn/mailman/listinfo/python-chinese > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese >", line 8, in Open
2007年07月13日 星期五 09:47
我遇到过这个问题,后来发现默认路径在"我的文档"下面。你试试。 在07-7-12,Wei Jiang <jiejisheng在gmail.com> 写道: > > 可以 print 出错信息, 中文平台会给出中文错误提示的。 > > On 7/12/07, python zhuang <python在zhuangzl.com> wrote: > > 你的疑问的前提是excel会在python进行的当前目录查找文件,但根据你提供的信息来看,似乎excel并不会这样做 > > > > On 7/12/07, 张建轶 <farsoftwind在gmail.com> wrote: > > > 谢谢python zhuang,我用绝对路径试了一下,正常运行。 > > > 但刚才那个程序文件开始,其实我已经设定路径了 > > > > > -------------- 下一部分 -------------- 一个HTML附件被移除... URL: http://python.cn/pipermail/python-chinese/attachments/20070713/537e934d/attachment-0001.html
2007年07月13日 星期五 09:50
Õâ¸öÊÇûÓÐÓõġ£ import os os.chdir('D:\\mytemp\\ch09_excel') ÒòΪÄãÊÇÓà 'Excel.Application' ´ò¿ªÎļþ£¬ ÁíÍâÍƼö Á½¸öpython ¶Á excel ¿â¡£ xlrd Ö÷ÒªÓÃÓÚ¶Á excel pyExcelerator ÓÃÓÚ¶Áд£¬ µ«ÊǶÁ¹¦ÄÜÈõ£¬Ö»ÄܶÁ³öÊý¾Ý£¬²»ÄܶÁ³ö¸ñʽ¡£ д¹¦ÄܽÏÇ¿¡£ wang_zheng_yong 2007-07-13 ·¢¼þÈË£º ÕŽ¨éó ·¢ËÍʱ¼ä£º 2007-07-12 19:57:25 ÊÕ¼þÈË£º python-chinese在lists.python.cn ³ËÍ£º Ö÷Ì⣺ Re: [python-chinese]PythonWin½áºÏexcel 2003ʹÓ㬴ò¿ªxlsÎļþ£¬Workbooks.Open·½·¨±¨´í£¬ÕâÊÇÔõô»ØÊÂÄØ£¿ ллpython zhuang£¬ÎÒÓþø¶Ô·¾¶ÊÔÁËһϣ¬Õý³£ÔËÐС£ µ«¸Õ²ÅÄǸö³ÌÐòÎļþ¿ªÊ¼£¬ÆäʵÎÒÒѾÉ趨·¾¶ÁË import os os.chdir('D:\\mytemp\\ch09_excel') ΪʲôBook2.xls´ò¿ª»á³öÎÊÌâÄØ£¿ÓÐʲô³åÍ»»òÕßÎÒʹÓÃos.chdirÓÐÎÊÌâÂð ÔÚ07-7-12£¬python zhuang <python在zhuangzl.com> дµÀ£º ÎļþÃû×îºÃ¸ø¾ø¶Ô·¾¶ --------------------------------------- 'ÎÞ·¨ÕÒµ½"Book2.xls"¡£Çë¼ì²éÎļþÃûµÄƴд£¬²¢¼ì²éÎļþλÖÃÊÇ·ñÕýÈ·¡£ Èç¹ûÄúÕýÊÔͼ´Ó"Îļþ"²Ëµ¥ÉÏ×î½üʹÓõÄÎļþÁбíÖдò¿ªÎļþ£¬ÇëÈ·ÈÏÎļþδ±»ÖØÃüÃû¡¢ Òƶ¯»òɾ³ý¡£' ---------------------------------------- On 7/12/07, ÕŽ¨éó <farsoftwind在gmail.com> wrote: > ʹÓÃPythonWinµ÷ÓÃExcel µÄ COM ×é¼þ£¬²¿·Ö³ÌÐòÈçÏ£¬µ«³ÌÐòÓ¦¸ÃûÓÐÎÊÌ⣬ÒòΪÊǽÚÑ¡×ÔÒ»±¾ºÜ¾µäµÄÊé > > class easyExcel: > def __init__(self,filename): > self.xlApp = > win32com.client.dynamic.Dispatch('Excel.Application') > self.filename = filename > self.xlBook = self.xlApp.Workbooks.Open(filename) > > > spr = easyExcel('Book2.xls') > > ÔËÐб¨´íÈçÏ > File "D:\mytemp\ch09_excel\exceldemos.py", line 155, in > getInvoices > spr = easyExcel('Book2.xls') > File "D:\mytemp\ch09_excel\exceldemos.py", line 30, in > __init__ > self.xlBook = self.xlApp.Workbooks.Open(filename) > File "> com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Office > Excel', > '\xce\xde\xb7\xa8\xd5\xd2\xb5\xbd\xa1\xb0Book2.xls\xa1\xb1\xa1\xa3\xc7\xeb\xbc\xec\xb2\xe9\xce\xc4\xbc\xfe\xc3\xfb\xb5\xc4\xc6\xb4\xd0\xb4\xa3\xac\xb2\xa2\xbc\xec\xb2\xe9\xce\xc4\xbc\xfe\xce\xbb\xd6\xc3\xca\xc7\xb7\xf1\xd5\xfd\xc8\xb7\xa1\xa3\n\n\xc8\xe7\xb9\xfb\xc4\xfa\xd5\xfd\xca\xd4\xcd\xbc\xb4\xd3\xa1\xb0\xce\xc4\xbc\xfe\xa1\xb1\xb2\xcb\xb5\xa5\xc9\xcf\xd7\xee\xbd\xfc\xca\xb9\xd3\xc3\xb5\xc4\xce\xc4\xbc\xfe\xc1\xd0\xb1\xed\xd6\xd0\xb4\xf2\xbf\xaa\xce\xc4\xbc\xfe\xa3\xac\xc7\xeb\xc8\xb7\xc8\xcf\xce\xc4\xbc\xfe\xce\xb4\xb1\xbb\xd6\xd8\xc3\xfc\xc3\xfb\xa1\xa2\xd2\xc6\xb6\xaf\xbb\xf2\xc9\xbe\xb3\xfd\xa1\xa3', > 'C:\\Program Files\\Microsoft > Office\\OFFICE11\\2052\\xlmain11.chm', 0, -2146827284), > None) > > Çë½Ì¸ÃÈçºÎ½â¾ö£¿ > > > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to > python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to > python-chinese-request在lists.python.cn > Detail Info: > http://python.cn/mailman/listinfo/python-chinese > _______________________________________________ python-chinese Post: send python-chinese在lists.python.cn Subscribe: send subscribe to python-chinese-request在lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20070713/c62c587b/attachment.htm >", line 8, in Open
Zeuux © 2025
京ICP备05028076号