Forums

Modify compdoc.py, a component in the xlrd module

Hi All,

I'm having some problems when I try to open an excel file with pd.read_excel().

The target file is one generated by PHPexcel. It cannot be opened directly with pandas. If I open it in excel first, then it is ok, but If I try it to open directly after it was downloaded, It shows an error. It seems that the solution is to add a pass condition in the file compdoc.py, that is part of the xlrd module. The one that pd.read_excel() uses.

Any help in order to edit the file or use an alternate method would be highly appreciated.

Thanks. Alejandro.

Hmm, I wouldn't normally suggest modifying modules like xlrd but if you've found a bug then perhaps it's the only way. The simplest trick to do that would be to install a private copy for your account, and then to modify it.

So, if you're using Python 3.6, then run the command

pip3.6 install --user xlrd

...to install a copy of the module in your private storage. (Change the "3.6" appropriately if you're using a different Python version, of course.)

This will put xlrd inside /home/amazzuca/.local/lib/python3.6/site-packages, where you can edit it.