0

I have an issue when I create a .exe file with autopytoexe. My command is

`pyinstaller --noconfirm --onefile --console  "C:/Users/user1/Desktop/test/script.py"

the problem is when I run this .exe I get

Traceback (most recent call last):
File "script.py", line 3, in <module>
ModuleNotFoundError: No module named 'Cryptodome'
[7020] Failed to execute script 'script' due to unhandled exception!

my imports in the script are

from Cryptodome.Cipher import AES
import hashlib
import os

I have cryptodome installed and I am 100% sure of this cause my script works as a .py file so it seems to be a problem with autopytoexe not including the cryptodome module in the .exe file. I tried adding the --hidden-import option to autopy aswell but did not help

Also tried using pyinstaller in the comand line instead of the gui same issue

also tried putting import cryptography at the start of my code

  • 1
    I don't think that is right... the documentation says it should be `from Crypto.Cipher` not `from Cryptodome.Cipher` – Alexander Feb 28 '23 at 09:23
  • tried that but now it says no module named crypto found... (in both from cryptocipher and from cryptodome the script works fine when it is run as a .py but as soon as I convert it to exe i get the problems so its as mentioned previously a problem with the conversion process by autopytoexe) – person1 Mar 01 '23 at 13:14

1 Answers1

0
try:
    from Crypto.Cipher import AES
    from Crypto.Util import Padding
    import hashlib
except ImportError:
    from Cryptodome.Cipher import AES
    from Cryptodome.Util import Padding
    import hashlib

did this as well but got

traceback modulenotfounderror: no module named crypto

and

traceback modulenotfounderror: no module named cryptodome