0

I need to compile my python code to .exe for user distribution. I was trying pyinstaller - works fine, but Win Defender was blocking generated .exe as virus. I tried several things to avoid it but unsuccessfully.

So now I try to use py2exe utility. I managed it run like this (this should be onefile):

from distutils.core import setup
import py2exe, sys, os

sys.argv.append('py2exe')

setup(
    options = {'py2exe': {'bundle_files': 1, 'compressed': True}},
    console = ["myApp.py"],
    zipfile = None,
)

Compiles ok, I can even run it from dist folder, but as soon as I move .exe to different place it gives me error:

AttributeError: module 'http.client' has no attribute 'HTTPSConnection'. Did you mean: 'HTTPConnection'?

Http is module used in myApp.

This is the content of dist folder:

enter image description here

Michal Palko
  • 601
  • 1
  • 4
  • 14

1 Answers1

0

You could use auto-py-to-exe and get a GUI to do the task. It allows you to make a single file. Just install using pip install auto-py-to-exe and run using the auto-py-to-exe command

Anshumaan Mishra
  • 1,349
  • 1
  • 4
  • 19
  • OK, but this is only GUI for pyinstaller and as I mentioned, pyinstaller output is blocked as virus by Win Defender. – Michal Palko Feb 14 '22 at 16:52