Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Py2exe and pycryptodome
#1
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,
Reply
#2
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]
Reply
#3
(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)
Reply
#4
(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.
Reply
#5
(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) ;-)
Reply
#6
About all ppl who have problem with false positive in pyinstaller, problem is occur because precompiled bootloader. If we recompile bootloader problem dissapered :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] Py2exe Writing UNKNOWN-0.0.0-py3.7.egg-info sarahroxon7 1 908 Apr-20-2022, 08:02 AM
Last Post: VadimCr
  Py2exe Writing UNKNOWN-0.0.0-py3.7.egg-info Rickus 2 3,609 Feb-18-2020, 03:09 PM
Last Post: Rickus
  py2exe failed to compiled gahhon 9 7,367 Mar-04-2019, 03:29 AM
Last Post: gahhon
  py2exe keegan_010 4 4,436 Aug-22-2018, 07:58 AM
Last Post: buran
  How would I combine multiple .py files into one .exe with Py2Exe shlomi27 0 3,066 Aug-20-2018, 10:27 AM
Last Post: shlomi27
  jira-2.0.0.dist causing error with py2exe johnlawlor 1 2,483 Aug-09-2018, 08:27 PM
Last Post: Larz60+
  can not open .exe file generated by py2exe: ImportError: cannot import name _remove_d py2exe 0 2,699 May-22-2018, 09:57 AM
Last Post: py2exe
  trouble with pip and py2exe sylas 12 13,626 Sep-17-2017, 06:38 AM
Last Post: sylas
  Convert py2exe daltorya19 6 5,324 May-28-2017, 11:48 PM
Last Post: daltorya19
  Py2EXE: terminal window closes after pressing ENTER peanutbutterjelly 1 5,053 May-06-2017, 07:13 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020