473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

building exe from script

Hello,

Is there any solution for building exe file from python script
something like bbfreeze.When user write some script in
my program, it must compile script into exe without opening console
( cmd ).I'am working on Windows XP SP2 and Python 2.5.

Regards,
Vedran

Aug 20 '07 #1
2 1902
you can embed py2exe in your program.
On 8/20/07, ve***********@v-programs.com <ve***********@v-programs.comwrote:
Hello,

Is there any solution for building exe file from python script
something like bbfreeze.When user write some script in
my program, it must compile script into exe without opening console
( cmd ).I'am working on Windows XP SP2 and Python 2.5.

Regards,
Vedran

--
http://mail.python.org/mailman/listinfo/python-list

--
Furkan Kuru
Aug 20 '07 #2
nih
A bit more information is clearly needed...

1. Create a file called py2exeSetup.py with the following contents:

from distutils.core import setup
import py2exe

def compile(appName, console=False):
OPTIONS = {"py2exe": {"compressed": 1, "optimize": 0, "bundle_files":
1, } }
ZIPFILE = None

if console:
setup(
options=OPTIONS,
zipfile=ZIPFILE,
console=[appName]
)
else:
setup(
options=OPTIONS,
zipfile=ZIPFILE,
windows=[appName]
)
2. Create another file called setup.py with the following contents

import py2exeSetup

# to stop a wxPython program from loading a console window you just need to
change the
# file extension from .py to .pyw

# change Filename to your XXXApp.pyw filename
# change to py2exeSetup.compile('Filename.pyw', console=True) to show the
console
py2exeSetup.compile('Filename.pyw')
3. Create a file called Compile.bat with the following contents

REM change Filename to your XXXApp.exe filename
REM make sure that python is in your system path

python setup.py py2exe
copy dist\Filename.exe Filename.exe
if errorlevel 1 pause
4. Put all these files in the same place as the program you want to convert
to exe and run Compile.bat
an *.exe file will now be in the same folder as your python files :)

I have py2exeSetup.py in a separate 'Shared' folder so there is only one
copy of it,
so all my programs only have setup.py and compile.bat in them
btw if you have a load of programs that you want to compile in one go the
add a file CompileAll.bat
in the root folder that all the programs are in, with the following
contents:

cd "ProgramOne"
call py2exe.bat
cd..

cd "ProgramTwo"
call py2exe.bat
cd..

# REM this part will execute if all programs compiled & copied ok
echo all copied ok!
pause
I know hardly anything about ms-dos, but this works ok:/

gl!

<ve***********@v-programs.comwrote in message
news:11*********************@r29g2000hsg.googlegro ups.com...
Hello,

Is there any solution for building exe file from python script
something like bbfreeze.When user write some script in
my program, it must compile script into exe without opening console
( cmd ).I'am working on Windows XP SP2 and Python 2.5.

Regards,
Vedran

Aug 20 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kylotan | last post by:
I need to be able to build Py2Exe from the source code as I am making a Windows executable where I wish to preprocess the modules before importing them.It looks like I can do this by adding lines...
1
by: Ed | last post by:
I am trying to use a Perl script which requires a Database module other than "dbm" to be the default Mod. So, what the script is checking is import anydbm if (anydbm._defaultmod.__name__ ==...
7
by: Christopher Benson-Manica | last post by:
Why is building a table with the DOM slower than using an array? IOW, why is var table=document.createDocumentFragment(); for( var i=0; i < 4000; i++ ) { tr=table.insertRow( table.rows.length...
3
by: SMH | last post by:
Normally an SVG document is loaded/parsed/interpreted inside an HTML document using an 'object' (or 'embed') element, although there are supposedly other ways too. The problem is, the SVG document...
13
by: treble54 | last post by:
I need to build PHP from source with the pdo_ibm extension and I am having an issue with it. Firstly, I am using Visual Studio .NET 2003 and I am building PHP from source through the Visual Studio...
4
by: stpark22 | last post by:
Hello, I'm building a tracking tool using Access 2003, where my users will be entering orders that includes quantity of products sold, and cost per unit. I'm in the process of building several...
15
by: kyosohma | last post by:
Hi, I am trying to get a small group of volunteers together to create Windows binaries for any Python extension developer that needs them, much like the package/extension builders who volunteer...
4
by: ramshankaryadav | last post by:
Hi, I'm facing a problem while building a project through MSBuild, this project is a part of a solution which has several other projects on which it depends, but I want to build this project...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.