Search code examples
pythonpyinstallerpyexcel

pyexcel.exceptions.UnknownParameters error after bundling with pyinstaller


I am trying to convert a python file to .exe using pyinstaller with the following command. Please suggest what is wrong with this approach.

pyinstaller.exe --hidden-import pyexcel --hidden-import pyexcel-io --hidden-import pyexcel_xls --hidden-import pyexcel_xlsx -F FormatBuster.py

The project have additional imports of pyexcel_xls, pyexcel_xlsx which is being handled with --hidden-import arguments. I am getting the following error when the .exe is run, however when the .py file is executed directly, it is working perfectly.

Traceback (most recent call last):
File "FormatBuster.py", line 90, in <module>
File "site-packages\pyexcel\core.py", line 36, in get_sheet
File "site-packages\pyexcel\internal\core.py", line 19, in get_sheet_stream
File "site-packages\pyexcel\internal\source_plugin.py", line 76, in get_source
File "site-packages\pyexcel\internal\source_plugin.py", line 65, in get_a_plugin
File "site-packages\pyexcel\internal\source_plugin.py", line 48, in load_me_now
File "site-packages\pyexcel\internal\source_plugin.py", line 138, in _error_handler
pyexcel.exceptions.UnknownParameters: Please check if there were typos in function parameters: {'file_name': 'C:\\Users\\kiranv1\\Documents\\R&D\\FormatBuster\\input\\DDVIJAYA_13_Apr_2018_Lot_1.xls'}. Otherwise unrecognized parameters were given.
[146004] Failed to execute script FormatBuster

The python file uses a .config file whose contents are as shown below

{
"params":{
    "inputpath":"C:\\Users\\kiranv1\\Documents\\R&D\\FormatBuster\\input",
    "outputpath":"C:\\Users\\kiranv1\\Documents\\R&D\\FormatBuster\\output",
    "logpath":"C:\\Users\\kiranv1\\Documents\\R&D\\FormatBuster\\output",
    "files": {
        "DDVIJAYA" : {
            "Due Date":"T2D",
            "Instalment No.":"T2N",
            "Instalment Amount":"T2N"
        }           
    }
}   
}

Solution

  • Adding answer as the Issue got resolved. The error occured due to missing dependency modules for PyExcel. The following github page list out all the dependencies required for packaging. PyExcel Dependency List for packaging

    Updated pyinstaller code is as given below

    pyinstaller --noconfirm --log-level=DEBUG ^
    --onefile ^
    --hidden-import pyexcel_io.readers.csvr
    --hidden-import pyexcel_io.readers.csvz
    --hidden-import pyexcel_io.readers.tsv
    --hidden-import pyexcel_io.readers.tsvz
    --hidden-import pyexcel_io.writers.csvw
    --hidden-import pyexcel_io.readers.csvz
    --hidden-import pyexcel_io.readers.tsv
    --hidden-import pyexcel_io.readers.tsvz
    --hidden-import pyexcel_io.database.importers.django
    --hidden-import pyexcel_io.database.importers.sqlalchemy
    --hidden-import pyexcel_io.database.exporters.django
    --hidden-import pyexcel_io.database.exporters.sqlalchemy
    --hidden-import pyexcel_xlsx
    --hidden-import pyexcel_xlsx.xlsxr
    --hidden-import pyexcel_xlsx.xlsxw
    --hidden-import pyexcel_xlsxw
    --hidden-import pyexcel_xlsxw.xlsxw
    --hidden-import pyexcel_xls
    --hidden-import pyexcel_xls.xlsr
    --hidden-import pyexcel_xls.xlsw
    FormatBuster.py