2

I wrote a script that opens and fetches values from .ods file and creates a new sheet and writes values using pyexcel and pyexcel_ods3 . After converting into an executable I get this error No suitable library found for ods .

Code :

    sheet = pyexcel.get_sheet(file_name="sample.ods")

pyexcel - 0.4.2 pyexcel-io - 0.3.1 pyexcel-ods3 - 0.3.0 PyInstaller - 3.2.1

PS : I tried hidden imports and hook. I did some work and think its due to __import__ in manager.py ofpyexcel_io.

Guhan
  • 21
  • 2
  • We have no idea what you wrote. – Mad Physicist Jan 26 '17 at 15:05
  • Sorry. This is my first time asking a question. My script works when running it as a script but after converting it to an executable causes error as 'No suitable library found for ods' . – Guhan Jan 26 '17 at 15:21
  • Trim down to a minimal example that exhibits the same behavior. Probably just an import and a printout of the package version will suffice. Then post it here (in your question, not in the comments). – Mad Physicist Jan 26 '17 at 15:23
  • Have you tried adding both `pyexcel` and `pyexcel_ods3` to `hidden_imports`? – taleinat Jan 26 '17 at 20:18

2 Answers2

1

Are you sure that the problem is not with using pyexcel to read the .ods file? Try using pyexcel_ods3 for fetching data from the .ods file:

sheet = pyexcel_ods3.read_data("sample.ods")

Once your script works with pyexcel_ods3, please refer to http://io.pyexcel.org/en/latest/pyinstaller.html for addition of hidden-imports.

I recently had similar issues but then I fixed my code and got a working .exe in this way.

Sarunas
  • 65
  • 7
0

You probably need to tell PyInstaller to include the pyexcel_ods3 library by adding it to the hidden_imports command-line parameter.

Another method to achieve the same goal is to explicitly import pyexcel_ods3 in one of your app's code files. This will cause PyInstaller to recognize the library as a dependency.

taleinat
  • 8,441
  • 1
  • 30
  • 44
  • Please reference http://stackoverflow.com/questions/42983559/unable-to-use-pyexcel-xls-with-pyinstaller-python-executable-not-working-pyt. And what's missing is: `--hidden_imports pyexcel_ods3.ods`. See the note here: http://pyexcel-io.readthedocs.io/en/latest/#special-note-on-pyinstaller – chfw Apr 03 '17 at 09:46