Python Forum

Full Version: cx_freeze exe does not work?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All

I have a very simple python file that I need to run of an exe. The program works perfectly through python console but when running the exe it does not produce an html file as it should.
Not sure if there is some dependencies needed to be included or what?
Please Help!

Program:
import folium
map = folium.Map(location=[-12.0742614,34.9538616],zoom_start=15)
map.add_child(folium.Marker( location=[-12.0742614,34.9538616], popup='TestLocation',icon=folium.Icon(color='orange')))
map.save("Map.html") 
cx_freeze setup file:
from cx_Freeze import setup, Executable
setup(name = "map1" ,
      version = "0.1" ,
      description = "" ,
       options = {'build_exe': {'excludes':excludes,'packages':packages,'includes':includes}},
      executables = [Executable("map1.py")])
if using windows, try py2exe see: https://python-forum.io/Thread-Intermedi...ith-Py2exe
if Linux, pyinstaller
and if OS X, pyapp.
(May-19-2018, 12:39 AM)Skycoder Wrote: [ -> ]cx_freeze setup file:
from cx_Freeze import setup, Executable
setup(name = "map1" ,
      version = "0.1" ,
      description = "" ,
       options = {'build_exe': {'excludes':excludes,'packages':packages,'includes':includes}},
      executables = [Executable("map1.py")])

Your setup file is fairly abbreviated from what you could be doing with it.

Try including the following line before your setup (name = "map1" , line.

includes = ["folium"]

Anytime I'm putting an include in my py file I include the item included in the includes = line.

Hope that does the trick for you!
Kip...
(May-19-2018, 02:06 AM)Larz60+ Wrote: [ -> ]if using windows, try py2exe see: https://python-forum.io/Thread-Intermedi...ith-Py2exe
if Linux, pyinstaller
and if OS X, pyapp.

I'm on Python 3.6 and if there is a wheel file I would definitely give it a shot! I haven't seen one as of yet.

Kip...

Larz60+, I got px2exe installed now I'm trying to figure out how to build my setup file to build my executable file. I would prefer to have this be a single file.

Here is the Python code:
import os
import sys
import subprocess
from socket import *

subprocess.call("cls", shell=True)

theargis = ''

if len(sys.argv) > 1:
    theargis +=str(sys.argv[1])

if theargis > '':
    host = theargis
    print ("Using Client Address of: " + theargis)
else:
    host = "53.68.240.47"
    print ("Using Default Address!")

port = 13000
buf = 1024
addr = (host, port)

UDPSock = socket(AF_INET, SOCK_DGRAM)
UDPSock.bind(addr)

print ("Waiting to receive messages...")

while True:
    (data, addr) = UDPSock.recvfrom(buf)
    print ("Production number: " + data.decode("utf-8"))
    if data.decode("utf-8").upper() == "EXIT":
        break

UDPSock.close()
os._exit(0)
But the only example I can find is the tutorial for py2exe which is:
from distutils.core import setup
   import py2exe
   
   setup(console=['hello.py'])
To which I swapped out the 'hello.py' for Receiver.py.

This of course didn't work at all.

Any good references, to help me build the setup file I'd need to convert this py to a single file exe.

Thanks,
Kip...
Apology!

I'm pulling my hair out over this one and in the process I thought that this was thread that I started. IT WAS NOT! I didn't have any intent to highjack someone else's thread. I thought I was responding to a comment to a thread I had started.

I still would like some insight on the setup file for py2exe but I apologize for the highjack.

Wall Wall Wall
Doh Doh Doh

Kip...