Python Forum
Build project with cxfreeze - 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: Build project with cxfreeze (/thread-27633.html)



Build project with cxfreeze - Kolterdyx - Jun-14-2020

I'm trying to make and executable from a project I'm working on, to test it on a different computer, without requiring python installed.

I want to use cx freeze to build and exe file, and this is my project tree:

(I used the output markdown to be able to keep the indentation, but this is just a diagram)
Output:
- Project - objects blocks.py enemy.py item.py player.py __init__.py - scripts camera.py chunk_manager.py __init__.py - textures - items - player - terrain - UI - void index.py __init__.py main.py settings.py setup.py map.json
As you can probably tell, this is a game.

Anyways, what I have done is executing just cxfreeze main.py --target-dir=./ dist and it generated a build directory with a lot of stuff in it. It generated a linux executable, but thats fine, I want to test if I can make it python-independent first, and I'll solve the .exe part later.

So, I executed the file, and nothing happened. Then I tried running from the terminal and it said that it was missing the camera.py file. I went into the generated directory and I found out that cxfreeze had not copied that file. I tried moving in in there myself, but it did not work.

I started checking for other files, and I found out that only the textures had been copied. I thought this was just because of the one line command I used, so I am now trying to make a setup.py file (as you can see in the file tree) but I am lost in how to import my custom packages (objects, scripts, and textures) and the files in the same directory as main.py

This is how my setup.py file looks like:

import sys
from cx_Freeze import setup, Executable


options = {
    'build_exe': {
        'includes': ['camera', 'chunk_manager'], 'path': sys.path + ['scripts']
    }
}

setup(
    name = "Void Boats",
    version = "alpha0.1",
    options = options,
    executables = [Executable("main.py")])
I am not sure how would I put all the packages in the 'include' section, and I can't find anything on the internet that uses more than a simple file like helloworld.py, and the samples of cxfreeze on their github only show how to import files from one directory. Do I have to move everything into one single package and put all the files in the same 'include'? Or can I have one include for each package I have? Any help would be pretty much appreciated.


RE: Build project with cxfreeze - buran - Jun-14-2020

cross-posted at Stackoverflow: https://stackoverflow.com/q/62373019/4046632


RE: Build project with cxfreeze - Kolterdyx - Jun-14-2020

I got an answer to this question on StackOverflow. You can check it out here
https://stackoverflow.com/a/62373116/13282963