PyError. Can't use ExcelReaders

PyError ($(Expr(:escape, :(ccall(#= /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class ‘xlrd.biffh.XLRDError’>
XLRDError(‘Excel xlsx file; not supported’)
File “/Users/yaroslav/.julia/conda/3/lib/python3.8/site-packages/xlrd/init.py”, line 170, in open_workbook
raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+’; not supported’)

Stacktrace:
[1] pyerr_check at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/exception.jl:62 [inlined]
[2] pyerr_check at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/exception.jl:66 [inlined]
[3] _handle_error(::String) at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/exception.jl:83
[4] macro expansion at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/exception.jl:97 [inlined]
[5] #109 at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:43 [inlined]
[6] disable_sigint at ./c.jl:446 [inlined]
[7] __pycall! at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:42 [inlined]
[8] _pycall!(::PyObject, ::PyObject, ::Tuple{String}, ::Int64, ::Ptr{Nothing}) at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:29
[9] pycall! at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:11 [inlined]
[10] #
#116 at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:86 [inlined]
[11] (::PyObject)(::String) at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:86
[12] openxl(::String) at /Users/yaroslav/.julia/packages/ExcelReaders/PgE1r/src/ExcelReaders.jl:64
[13] top-level scope at In[47]:3
[14] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091

Hard to help without a MWE (please look at PSA: make it easier to help you)

That said, the error message seems clear - “Excel xlsx file; not supported”, so you are probably using an Excel reader that only allows reading xls format, not the newer xlsx format. I think the default reader used by pandas has recently dropped support for xlsx - here’s an SO question about it with suggested workaroudns: python - xlrd.biffh.XLRDError: Excel xlsx file; not supported - Stack Overflow

using ExcelReaders, JuMP, Plots, Gurobi
cd("/Users/yaroslav/Desktop/Diplom/")
file5=openxl(“ASG data 14.06.2018 (new data).xls”)

same error with xls
using ExcelReaders, JuMP, Plots, Gurobi
cd("/Users/yaroslav/Desktop/Diplom/")
file5=openxl(“ASG data 14.06.2018 (new data).xls”)

I’d use XLSX.jl: GitHub - felipenoris/XLSX.jl: Excel file reader and writer coded in pure Julia. Maybe you’ll have better luck with that package.

with . xls
file5=openxl(“ASG-data-14.06.2018-new-data.xls”)

PyError ($(Expr(:escape, :(ccall(#= /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class ‘xlrd.compdoc.CompDocError’>
CompDocError(‘Workbook corruption: seen[2] == 4’)
File “/Users/yaroslav/.julia/conda/3/lib/python3.8/site-packages/xlrd/init.py”, line 172, in open_workbook
bk = open_workbook_xls(
File “/Users/yaroslav/.julia/conda/3/lib/python3.8/site-packages/xlrd/book.py”, line 68, in open_workbook_xls
bk.biff2_8_load(
File “/Users/yaroslav/.julia/conda/3/lib/python3.8/site-packages/xlrd/book.py”, line 641, in biff2_8_load
cd.locate_named_stream(UNICODE_LITERAL(qname))
File “/Users/yaroslav/.julia/conda/3/lib/python3.8/site-packages/xlrd/compdoc.py”, line 398, in locate_named_stream
result = self._locate_stream(
File “/Users/yaroslav/.julia/conda/3/lib/python3.8/site-packages/xlrd/compdoc.py”, line 429, in _locate_stream
raise CompDocError("%s corruption: seen[%d] == %d" % (qname, s, self.seen[s]))

Stacktrace:
[1] pyerr_check at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/exception.jl:62 [inlined]
[2] pyerr_check at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/exception.jl:66 [inlined]
[3] _handle_error(::String) at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/exception.jl:83
[4] macro expansion at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/exception.jl:97 [inlined]
[5] #109 at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:43 [inlined]
[6] disable_sigint at ./c.jl:446 [inlined]
[7] __pycall! at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:42 [inlined]
[8] _pycall!(::PyObject, ::PyObject, ::Tuple{String}, ::Int64, ::Ptr{Nothing}) at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:29
[9] pycall! at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:11 [inlined]
[10] #
#116 at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:86 [inlined]
[11] (::PyObject)(::String) at /Users/yaroslav/.julia/packages/PyCall/tqyST/src/pyfncall.jl:86
[12] openxl(::String) at /Users/yaroslav/.julia/packages/ExcelReaders/PgE1r/src/ExcelReaders.jl:64
[13] top-level scope at In[76]:5
[14] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091

Thanks a lot!

1 Like