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

Hello Aspose team,

I’m getting the below import errors when I try to run a compiled Windows EXE file. The EXE file is compiled with Nuitka. The sample code below runs fine.

System

Python: 3.10.10
Flavor: CPython Official
OS: Windows
Arch: x86_64
Windows Release: 10

Installed packages

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

The EXE is built with
python -m nuitka --standalone aspose-mapi.py

Import errors

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()

I’ve also filed a report with the Nuitka team. They are wondering whether the DLLs in aspose\netcore\netcore3.1 are needed.

Can you please let me know how to resolve the import errors?

Thank you!

Hello @dschaut ,

Thanks for contacting our support forum.
We will investigate this issue and give you a feedback.

Hello @dschaut,

We have opened the following new investigation ticket in our internal issue tracking system.

Issue ID(s): EMAILNET-41214

And we will contact you as soon as we receive the results of our review of this issue.

Thank you.