Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

openpyxl library - jdcal error

I'm trying to work on some excel files, I decided to use openpyxl library. I've copied the openpyxl folder to /Lib/ and trying to do the import command on some sample code, and all I get is a list of few errors.

    Traceback (most recent call last):
  File "C:/Users/Karolina/Documents/python/test xlsx.py", line 1, in <module>
    import openpyxl
  File "C:\Python34\lib\openpyxl\__init__.py", line 9, in <module>
    from openpyxl.workbook import Workbook
  File "C:\Python34\lib\openpyxl\workbook\__init__.py", line 5, in <module>
    from .workbook import *
  File "C:\Python34\lib\openpyxl\workbook\workbook.py", line 14, in <module>
    from openpyxl.utils.datetime  import CALENDAR_WINDOWS_1900
  File "C:\Python34\lib\openpyxl\utils\datetime.py", line 11, in <module>
    from jdcal import (
ImportError: cannot import name 'gcal2jd'

First I was getting the same error about "jdcal" so I have installed the library called jdcal. Now I have no clue how to fix this one, what is wrong with it? I'm using python 3.4

like image 467
Denis Wasilew Avatar asked Jun 16 '15 11:06

Denis Wasilew


2 Answers

openpyxl module has 2 dependent modules : 1. jdcal 2. et_xmlfile

I was able to install openpyxl module and this is what I did :

  1. Downloaded the openpyxl,jdcal and et_xmlfile from https://pypi.python.org/pypi and saved jdcal-1.0.tar.gz, et_xmlfile-1.0.0.tar.gz,openpyxl-2.3.0-b2.tar.gz in a local folder in my system.

  2. Then I ran the commands in the following order :

    pip install jdcal-1.0.tar.gz
    pip install et_xmlfile-1.0.0.tar.gz
    pip install openpyxl-2.3.0-b2.tar.gz
    

openpyxl got successfully after this.

like image 113
Adithya Rao Avatar answered Oct 01 '22 21:10

Adithya Rao


Actually openpyxl depends upon jdcal & et_xmlfile. You first require to install these two packages. I have managed to run openpyxl by downloading and giving refrencing some thing like this:

#For Writing in Excel File
import sys
#For openpyxl-2.4.0 Python Package you should need to have et_xmlfile and jdcal package
sys.path.append("D:\et_xmlfile-1.0.1")
sys.path.append("D:\jdcal-1.3")
sys.path.append('D:\openpyxl-2.4.0')

import openpyxl
like image 34
Muhammad Faizan Khan Avatar answered Oct 01 '22 22:10

Muhammad Faizan Khan