Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
990 views
in Technique[技术] by (71.8m points)

windows - Unable to use pyexcel-xls with pyinstaller . python executable not working . python version 3.4.4

The program works when run using:

Python filename.py

but when I create its executable file using "pyinstaller"

pyinstaller -F filename.py

the executable is successfully created, but execution of the script fails and following error is thrown.

Traceback (most recent call last):
  File "site-packagespyexcel_iomanager.py", line 160, in create_reader
  File "site-packagespyexcel_iomanager.py", line 222, in _get_a_handler
pyexcel_io.manager.NoSupportingPluginFound: No suitable library found for xls

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "script.py", line 8, in <module>
  File "site-packagespyexcel_xls\__init__.py", line 29, in get_data
  File "site-packagespyexcel_ioio.py", line 36, in get_data
  File "site-packagespyexcel_ioio.py", line 126, in load_data
  File "site-packagespyexcel_iomanager.py", line 171, in create_reader
pyexcel_io.manager.SupportingPluginAvailableButNotInstalled: Please install pyexcel-xls
Failed to execute script script

The respective python script is :

from pyexcel_xls import save_data , get_data
data = get_data("registered-market-makers-by-security.xls")
save_data("file_to_consume.xls", data)

How can I avoid this error and create a functional .exe file?

My client has windows environment.

I have also tried py2exe but it has some conflicts with windows dll's in my machine.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The Problem

pyexcel-io uses a method for including plug-ins that pyinstaller does not support. See this issue.

The Workaround

The work around for this issue has a couple of facets.

Change needed to pyexcel

I have submitted a Change Request which shows how to modify pyexcel to allow it to work with pyinstaller. Basically pyexcel-io needs to know how to find frozen modules.

If the pyexcel guys pick up the Change Request, then that will get you going. But if they don't, or you are in a hurry, then copying the changed file from the change request into your site package directory as pyexcel_io/__init__.py will get pyexcel working.

But, pyinstaller also needs to know what to include.

pyinstaller also needs to know to include the required module. So on the pyinstaller command line you will also need to do:

--hidden-import pyexcel_xls.xls

Update:

Change request with this fix has been merged into master branch of pyexcel.

Update #2:

Fix has been released to pypi.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...