pythonpyinstalleraspose.words

One or more errors occurred while loading the module 'aspose.word'(-1009)


I'm trying to make an executable with pyinstaller but it's giving an error in a library I'm using called aspose.words

this is the error that appears to me:

enter image description here

if the image does not open:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
KeyError: 'aspose.pydrawing'

The above exception was the direct cause of the following exception:

ImportError: Unable to import module dependencies. Cannot import the aspose.pydrawing module. The module not found or errors occurred while initializing it.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "main.py", line 3, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "Scripts\login.py", line 6, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "Scripts\principal.py", line 10, in <module>
  File "aspose\__init__.py", line 48, in load_module
  File "aspose\__init__.py", line 80, in _load_native_module
ImportError: One or more errors occurred while loading the module 'aspose.words' (-1009)

this is the command I used to create the executable:

pyinstaller --noconsole --onefile  --collect-binar
ies "aspose" --collect-submodules "aspose" main.py --ico 3151580_game_maze_retro_icon.png

I saw a post here that needed to include aspose with the: --collect-binar command ies "aspose" --collect-submodules "aspose". but the error continued


Solution

  • Try to use --collect-all option instead of --collect-binaries and --collect-submodules ones: such approach helped me.

    i.e., try to use the following command:

    pyinstaller --noconsole --onefile  --collect-all "aspose" main.py --ico 3151580_game_maze_retro_icon.png