pyexcel.exceptions.UnknownParameters 与 pyinstaller 捆绑后出错

pyexcel.exceptions.UnknownParameters error after bundling with pyinstaller

我正在尝试使用 pyinstaller 和以下命令将 python 文件转换为 .exe。请指出这种方法有什么问题。

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

该项目有额外的导入 pyexcel_xls,pyexcel_xlsx 正在使用 --hidden-import 参数处理。当 .exe 为 运行 时出现以下错误,但是当直接执行 .py 文件时,它运行良好。

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

python文件使用.config文件,其内容如下图

{
"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"
        }           
    }
}   
}

在问题得到解决后添加答案。由于缺少 PyExcel 的依赖模块而发生错误。下面的 github 页面列出了打包所需的所有依赖项。 PyExcel Dependency List for packaging

更新后的 pyinstaller 代码如下

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