Nuitka icon indicating copy to clipboard operation
Nuitka copied to clipboard

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

Open dschaut opened this issue 1 year ago • 2 comments

python -m nuitka --version:

1.8.4
Commercial: None
Python: 3.10.10 (tags/v3.10.10:aad5f6a, Feb  7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)]
Flavor: CPython Official
Executable: C:\Users\user\Documents\dev\bitbucket\beat-reports\venv\Scripts\python.exe
OS: Windows
Arch: x86_64
WindowsRelease: 10
Version C compiler: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\Hostx64\x64\cl.exe (cl 14.3)

python -m pip freeze:

Aspose.Email-for-Python-via-NET==23.9
Nuitka==1.8.4
ordered-set==4.1.0
zstandard==0.22.0

Built with: python -m nuitka --standalone aspose-mapi.py

The sample code runs all fine. When the compiled Windows EXE is run from the *.dist folder, one or more import errors occur while loading the module 'aspose.email'.

Microsoft Windows [Version 10.0.19045.3570]
(c) Microsoft Corporation. All rights reserved.

C:\Users\user\Documents\dev\bitbucket\beat-reports\bin\aspose-mapi.dist>aspose-mapi.exe
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 672, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 640, in _load_backward_compatible
KeyError: 'aspose.pyreflection'

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

ImportError: Unable to import module dependencies. Cannot import the aspose.pyreflection 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 "C:\Users\user\DOCUME~1\dev\BITBUC~1\BEAT-R~1\bin\ASPOSE~1.DIS\aspose-mapi.py", line 1, in <module>
ImportError: One or more errors occurred while loading the module 'aspose.email' (-1009)

Sample Code:

from aspose.email.mapi import MapiMessage


def main():
    print("Is MSG format:", MapiMessage.is_msg_format(r"C:\path\to\file.msg"))
    msg = MapiMessage.load(r"C:\path\to\file.msg")
    print("Subject:", msg.subject)
    print("From:", msg.sender_email_address)


if __name__ == "__main__":
    main()

dschaut avatar Nov 03 '23 15:11 dschaut

The output of --list-package-dlls=aspose looks just crazy, it's 230 DLLs. I am surprised about api-ms-win-crt-filesystem-l1-1-0.dll and the like, but maybe .NET really needs those. This one is not so easy, I specifically feel unsure of aspose\netcore\netcore3.1 and its need.

kayhayen avatar Nov 04 '23 09:11 kayhayen

@kayhayen - thanks for looking into this issue. If needed, I can reach out to the Aspose team and try to facilitate additional information. Merely let me know what questions I should forward.

dschaut avatar Nov 04 '23 17:11 dschaut

this was fixed recently no?

KRRT7 avatar Mar 22 '24 07:03 KRRT7

That's right, this works nowadays.

kayhayen avatar Mar 22 '24 13:03 kayhayen