473,763 Members | 7,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1916
you can embed py2exe in your program.
On 8/20/07, ve***********@v-programs.com <ve***********@ v-programs.comwro te:
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_fil es":
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.com pile('Filename. pyw', console=True) to show the
console
py2exeSetup.com pile('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.e xe 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.comwro te in message
news:11******** *************@r 29g2000hsg.goog legroups.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
2683
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 to Load_Module() in py2exe's start.c. However problem I have is that I can't build Py2Exe using the instructions provided. Using the designated command of "python setup.py install" I get this error: Traceback (most recent call last): File...
1
4106
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__ == 'dumbdbm' or anydbm._defaultmod.__name__ == 'dbm'): First of, I'm doing this on a Sparc/Solaris 8 box. So, I'm trying to get gdbm to be the default mod. I've downloaded and
7
1701
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 ); td=tr.appendChild( document.createElement('td') ); td.appendChild( 'foo' ); } someElement.appendChild( table );
3
6358
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 must be static this way. I want to use the DOM interface to build SVG dynamically inside an HTML document. I am guessing I can build it inside HTML within an 'object' (or maybe 'iframe'?) element. My intentions/goals:
13
3118
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 Command Prompt. When I get to the nmake step, it gets through everything until it hits the zend_language_scanner.l file. Then I get these errors: zend_language_scanner.l(24) : warning C4005: 'yyleng' : macro redefinition...
4
2193
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 instant reports where they can click on a control without having to specific any criterias such as data ranges and pull up an instant report What I'm having trouble with is building reports that will compute totals by certain dates (Totals For...
15
3225
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 their time to create Linux RPMs. The main thing I need are people willing to test the binaries to make sure the extension is stable. This would require installing the binary and probably downloading the source too to get the developer's test
4
3357
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 without building it's dependencies. We can do this for a solution by unselecting projects through Configuration Manager under solution properties, but how to achive same for a project!
0
9563
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9997
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9937
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9822
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.