May12
May12

Reputation: 2520

Why pyexcel throws exception "UnknownParameters: Please check if there were typos in function parameters"?

My Python 3.5 code looks like:

folder_with_files = 'C:\\procXls\\20170809\\'
path_to_m = folder_with_files + names[0]
sheet_m = pe.get_sheet(file_name=path_to_m) #this is 72 line 

When i execute programm in IDE everything works fine. But after compiling into .exe file using pyinstaller and run programm i receive the next stacktrace:

C:\procXls>procXls.exe
2017-08-10 11:31:42,316 - root - INFO - Begin
['M_09082017.XLS', 'M_MVT_09082017.XLS', 'M_TRN_09082017.XLS', 'D_09082017.XLSX', 'I_09082017.XLSX']
Processing file C:\procXls\20170809\M_09082017.XLS
2017-08-10 11:31:42,317 - pyexcel.internal.source_plugin.SourcePluginManager - DEBUG - load me now:sheet-read
Traceback (most recent call last):
  File "procXls.py", line 72, 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:\\procXls\\20170809\\M_09082017.XLS'}. Otherwise unrecognized parameters were given.
Failed to execute script procXls

Does anybody know how to fix this exception?

UPDATE

I changed my code:

folder_with_files = os.path.join("c:\\", "procXls", "20170809\\") 
path_to_m = os.path.join(folder_with_files, names[0])

but the traceback is the same :

Process file: c:\procXls\20170809\M_09082017.XLS
2017-08-11 09:42:53,983 - pyexcel.internal.source_plugin.SourcePluginManager - DEBUG - load me now:sheet-read
Traceback (most recent call last):
  File "procXls.py", line 75, 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:\\procXls\\20170809\\M_09082017.XLS'}. Otherwise unrecognized parameters were given.
Failed to execute script procXls

UPDATE 1

The problem is not still solved. pip list returns:

amqp (2.2.1)
asn1crypto (0.22.0)
bcrypt (3.1.3)
billiard (3.5.0.3)
celery (4.1.0)
cffi (1.10.0)
cryptography (2.0.3)
cx-Freeze (5.0.2)
ezodf (0.3.2)
Fabric (1.13.2)
fdb (1.7)
future (0.16.0)
idna (2.5)
kombu (4.1.0)
lml (0.0.1)
lxml (3.8.0)
numpy (1.13.1)
pandas (0.20.3)
paramiko (2.2.1)
pdfkit (0.6.1)
pip (9.0.1)
pyasn1 (0.3.2)
pycparser (2.18)
pyexcel (0.5.3)
pyexcel-io (0.4.3)
pyexcel-ods3 (0.4.0)
pyexcel-xls (0.4.0)
PyInstaller (3.2.1)
PyNaCl (1.1.2)
pypiwin32 (219)
pypyodbc (1.3.4)
python-dateutil (2.6.1)
pytz (2017.2)
PyYAML (3.12)
setuptools (18.2)
six (1.10.0)
texttable (0.9.1)
vine (1.1.4)
wkhtmltopdf (0.2)
xlrd (1.0.0)
xlwt (1.2.0)

May it help to solve the issue?

Upvotes: 0

Views: 830

Answers (2)

chfw
chfw

Reputation: 4592

You need to tell pyinstaller about the hidden imports:

--hidden-import pyexcel_xls
--hidden-import pyexcel_xls.xlsr
--hidden-import pyexcel_xls.xlsw

Similar problems:

Reading xlsx files in py2exe

People tried with pyinstaller with success.

Upvotes: 0

Diego F Medina
Diego F Medina

Reputation: 499

If it is running in IDE and not as .exe, could it be that the path format you are giving is not understandood later? I usually do not like to create paths using '//' or some variation. Try using:

folder_with_files = os.path.join("c:", "procXls", "20170809")
path_to_m = os.path.join(folder_with_files, names[0])
sheet_m = pe.get_sheet(file_name=path_to_m)

And see how it goes :)

Upvotes: 1

Related Questions