在Ironpython中使用XLRD [英] Using XLRD in Ironpython

查看:547
本文介绍了在Ironpython中使用XLRD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在IronPython 2.7中使用XLRD库

I am trying to use the XLRD library in IronPython 2.7

在打开.xls文件(2003格式)的最基本的操作中,我收到以下错误,我不知道如何解决它:

At the most basic operation of opening an .xls file (2003 format) I get the following error, and I am not sure how to fix it:

  workbook = xlrd.open_workbook(xlsfile)

  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\xlrd\__init__.py", line    426, in open_workbook
  TypeError: sequence item 0: expected bytes or byte array, str found

任何想法?我想使用xlrd如果可能,但似乎可能会有一些兼容性问题。当使用Python 2.7解释器时,文件没有打开任何问题。

any ideas? i would like to use xlrd if possible but seems like there may be some compatibility problems. When using Python 2.7 interpreter the file opens no problem ..

推荐答案

我在xlrd 0.9.2中与此进行了一段时间的斗争。 字节 bytearray str ,甚至阅读文件手动并将其作为 file_contents 工作。

I fought with this for some time in xlrd 0.9.2. Neither bytes, bytearray, str, or even reading the file manually and passing it as file_contents worked.

最后我将xlrd降级到版本0.8.0和...它的工作:)

Finally I downgraded xlrd to version 0.8.0 and... it's working. :)

这篇关于在Ironpython中使用XLRD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆