Giter Site home page Giter Site logo

Comments (3)

albertosottile avatar albertosottile commented on May 28, 2024

Hi, thanks for reporting this issue. As I stated some times in this repository, py2exe is quite a large project with a lot of options, and I am not able to maintain them all as I would like to. Personally, I never used the bundle_files = 1 option, so I cannot tell you right away if that feature is still working in the latest versions.

That being said, I am willing to investigate this bug and perhaps implement a minimal test in the CI /CD chain to retain this functionality. Could you provide me a minimal working code (setup.py and main Python script) to reproduce this bug?

from py2exe.

ivan2033 avatar ivan2033 commented on May 28, 2024

Yes, of course. I tried first with a very simple example:

Main.py

import sys
import os

f = open('mylog.log', 'w')
f.write('Hello world')
f.close()

setup.py

from distutils.core import setup
import py2exe

mainfile = r'C:\Main.py'
exefile = 'Main'

setup(name="Main",
version='0.0',
description="Main script",
scripts=[mainfile],
windows=[{"script":mainfile,
'company_name' : "Company (c) 2019",
'copyright' : "Company (c) 2019",
#'uac_info': "requireAdministrator",
'dest_base' : exefile}],
#"icon_resources":[(0, icon_file)]}],
data_files = [],
options={"py2exe": {"unbuffered": True,
"optimize": 2,
"bundle_files": 1,
"compressed": False,
"includes": [],
"excludes" : [],
"packages": [],
"dll_excludes": []},},
zipfile=None)

The output is as follows:
dist

Until now, we were working with python2 and everything was packeted inside de EXE file using bundle_files=1. That was very convinient for use in order to use a portable instalation. I do not know if this has changed now with newer py2exe versions.

Thanks for replying so fast.
Best regards.

from py2exe.

albertosottile avatar albertosottile commented on May 28, 2024

I think the setting has been changed during the transition to Python 3. Now the setting you are looking for is "bundle_files": 0. I tested your script and setup files with this option and I can confirm it works as expected. With the option set to 1, all the dependencies except for external DLLs are embedded in the executable, which is the behavior you were witnessing. The relevant docstrings are here: https://github.com/albertosottile/py2exe/blob/4c524b954183087d7374c79cfd2cd3caadebebf1/py2exe/setup_template.py#L132-L142

It is worth to mention that decreasing the value of bundle_files can cause more errors when importing several packages. Some of these are caught by the hook systems, others will just fail at execution time.

Since the basic feature is still working as expected, I am closing this issue now. Please feel free to reopen it anytime, if needed.

from py2exe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.