Python Forum
Py2exe and pycryptodome - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Py2exe and pycryptodome (/thread-31510.html)



Py2exe and pycryptodome - reks2004 - Dec-16-2020

Hello,

I have problem with compiling application by py2exe.
Application uses Crypto libs (pycryptodome). My setup.py
from distutils.core import setup
import py2exe

setup(
    options = {'py2exe': {'compressed': True, 'bundle_files': 0, 'excludes': ['tcl', 'tkinter'], 'packages': ['Crypto'],
                          }},
    windows=[{'script':'test.py'}],
    zipfile = None, #"lib/shared.lib",
   
 
)
But when i want start app i get errors like
Error:
Traceback (most recent call last): File "test.py", line 9, in <module> File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 668, in _load_unlocked File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible File "zipextimporter.pyc", line 87, in load_module File "Crypto\Cipher\__init__.pyc", line 27, in <module> File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 668, in _load_unlocked File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible File "zipextimporter.pyc", line 87, in load_module File "Crypto\Cipher\_mode_ecb.pyc", line 47, in <module> File "Crypto\Util\_raw_api.pyc", line 308, in load_pycryptodome_raw_lib OSError: Cannot load native module 'Crypto.Cipher._raw_ecb': Trying '_raw_ecb.cp37-win_amd64.pyd': cannot load library 'C:\xxx\test.exe\Crypto\Util\..\Cipher\_raw_ecb.cp37-win_amd64.pyd': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'C:\\xxx\\test.exe\\Crypto\\Util\\..\\Cipher\\_raw_ecb.cp37-win_amd64.pyd', Trying '_raw_ecb.pyd': cannot load library 'C:\xxx\test.exe\Crypto\Util\..\Cipher\_raw_ecb.pyd': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'C:\\xxx\\test.exe\\Crypto\\Util\\..\\Cipher\\_raw_ecb.pyd'
I checked, path are right and file exist(for example file name is _raw_ecb.pyd).
Any idea? Problem dont occur if i use bundle_file=3 and files arent packed to exe or lib file (when i use zip option).

Best regards,


RE: Py2exe and pycryptodome - snippsat - Dec-16-2020

py2exe is dead💀
Last version it worked on was Python 3.4.

Use Pyinstaller ,and Pyinstaller has moved away from PyCryptodome(outdated) for bytecode encryption,to tiny-AES.
pip install pyinstaller[encryption]



RE: Py2exe and pycryptodome - reks2004 - Dec-16-2020

(Dec-16-2020, 12:18 PM)snippsat Wrote: py2exe is dead💀
Last version it worked on was Python 3.4.

Use Pyinstaller ,and Pyinstaller has moved away from PyCryptodome(outdated) for bytecode encryption,to tiny-AES.
pip install pyinstaller[encryption]

I have version from nov 2020 of py2exe :)
https://pypi.org/project/py2exe/#history

I cant use Pyinstaller, because i use crypto libs my AV marking it as virus (only if i compile it by Pyinstaller)


RE: Py2exe and pycryptodome - snippsat - Dec-16-2020

(Dec-16-2020, 12:53 PM)reks2004 Wrote: I have version from nov 2020 of py2exe :)
So i see py2exe have risen from dead⏰

(Dec-16-2020, 12:53 PM)reks2004 Wrote: I cant use Pyinstaller, because i use crypto libs my AV marking it as virus (only if i compile it by Pyinstaller)
That's a false positive from your AV,there should be a exclusions option for folder/files.
I think Pyinstaller with tiny-AES(which have been included and tested by pyinstaller),is much better option.


RE: Py2exe and pycryptodome - reks2004 - Dec-16-2020

(Dec-16-2020, 02:54 PM)snippsat Wrote:
(Dec-16-2020, 12:53 PM)reks2004 Wrote: I have version from nov 2020 of py2exe :)
So i see py2exe have risen from dead⏰

(Dec-16-2020, 12:53 PM)reks2004 Wrote: I cant use Pyinstaller, because i use crypto libs my AV marking it as virus (only if i compile it by Pyinstaller)
That's a false positive from your AV,there should be a exclusions option for folder/files.
I think Pyinstaller with tiny-AES(which have been included and tested by pyinstaller),is much better option.

I understand your opinion but i still need to fix my problem(stays with py2exe) ;-)


RE: Py2exe and pycryptodome - reks2004 - Dec-16-2020

About all ppl who have problem with false positive in pyinstaller, problem is occur because precompiled bootloader. If we recompile bootloader problem dissapered :)