473,395 Members | 1,466 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,395 software developers and data experts.

How to create a single executable console application?

I followed the instructions from
http://starship.python.net/crew/thel...FileExecutable

Copied the second setup.nsi, setup.py, single.py and everything works
like a
champ.

I then replaced "single.exe" by "hello.exe" in setup.nsi. Created
hello.py as
follows:

#! python
def main():
print 'Hello world'

if __name__ == '__main__':
main()
#End of file

And changed setup.py as follows:

#! python
from distutils.core import setup
import py2exe
sys.argv.append('py2exe')

setup( console=["hello.py"] )
# End of file

After running python setup.py, dist\hello.exe was created and it runs
fine
("Hello world" printed on the console).

Compiled setup.nsi, and hello.exe was created in current directory.
However,
when executed, nothing was printed.

I might just missed something obvious. Can anyone help me?

Has anyone built a single executable for console application? Please
post your .nsi file.

Thanks very much,
P

Apr 10 '06 #1
2 2751
Alright, pythoneers, here is what I have found from
http://wiki.wxpython.org/index.cgi/C...oneExecutables. This
is much easier than the py2exe + nullsoft combo :)

Cheers!

The mcillian installer development is discontinued.

mirror:
http://davidf.sjsoft.com/mirrors/mcm...ller_dnld.html

Continued development(not tested yet):
http://pyinstaller.hpcf.upr.edu/cgi-bin/trac.cgi

This works on Win32.
Unzip the Installer in a directory of your choice, and cd there.

Configure the Installer by running:

python Configure.py

Python must be in your PATH for this to work, if it's not, type from
the command prompt: PATH=%PATH%;c:\python23

where c:\python23 must be replaced with the root of your python
installation.
Then, assuming the source code is app.py (placed in c:\source): python
Makespec.py --upx --onefile --noconsole c:\source\app.py
python Build.py app\app.spec

Replace 'app' everywhere above with your application name.
You will end up with app\app.exe under the Installer dir.This is a one
file .exe containing all the application.
If you don't want a one-file build, suppress the option --onefile
above.
If you don't have upx installed (or don't want to use it), suppress the
option --upx above.
The option --noconsole is needed to produce a windows gui application,
instead of a console one (so the command shell won't pop up when you
run the application).

Apr 14 '06 #2
Alright, pythoneers, here is what I have found from
http://wiki.wxpython.org/index.cgi/C...oneExecutables. This
is much easier than the py2exe + nullsoft combo :)

Cheers!

The mcillian installer development is discontinued.

mirror:
http://davidf.sjsoft.com/mirrors/mcm...ller_dnld.html

Continued development(not tested yet):
http://pyinstaller.hpcf.upr.edu/cgi-bin/trac.cgi

This works on Win32.
Unzip the Installer in a directory of your choice, and cd there.

Configure the Installer by running:

python Configure.py

Python must be in your PATH for this to work, if it's not, type from
the command prompt: PATH=%PATH%;c:\python23

where c:\python23 must be replaced with the root of your python
installation.
Then, assuming the source code is app.py (placed in c:\source): python
Makespec.py --upx --onefile --noconsole c:\source\app.py
python Build.py app\app.spec

Replace 'app' everywhere above with your application name.
You will end up with app\app.exe under the Installer dir.This is a one
file .exe containing all the application.
If you don't want a one-file build, suppress the option --onefile
above.
If you don't have upx installed (or don't want to use it), suppress the
option --upx above.
The option --noconsole is needed to produce a windows gui application,
instead of a console one (so the command shell won't pop up when you
run the application).

Apr 14 '06 #3

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

Similar topics

3
by: Johnnie Norsworthy | last post by:
How do I get my console application's executable file name with path? I would like to extract the path and do a System.IO.Directory.SetCurrentDirectory(). Thanks, Johnnie
6
by: Sunny | last post by:
Hi, I have a very serious issue at hand. I have created a small C# Console App (Csd.exe) that collects a list of files as its argument and generates their Md5 sets. This application is used by...
3
by: Gustavo L. Fabro | last post by:
Greetings! I'm a newbie in Visual C++ .NET (have programmed in Borland C++ and Builder for long) and I am trying to do a very simple thing, but I'm stuck. I created an (unmanaged) DLL project...
2
by: §iD` | last post by:
Hi! I would like to create a virtual folder (which I want to mount) and populate managing his content by a DLL or something like that in VB.NET (2.0). How can I acomplish this? Thanks to...
1
by: Keith McDonald | last post by:
We have executable program that is used to create and send emails to users. Working on getting it able to be called from a web page we're having some problems. First of all if debugging the...
3
by: Mo | last post by:
Hi, Is there a way to include an executable (xxx.exe) file inside a c# console project so that the resulting project binary have only one final executable file? My c# console application is...
1
by: mohaaron | last post by:
Hello all, This might seem like an odd question but I would like to know how to create a standalone executable. I'm using vs.net 2005 and the closest project template I can find for what I want...
6
by: Michael Tissington | last post by:
Using Visual Studio 2008 can someone point me to an example to create a cgi web service in C# ? Thanks.
0
by: jeremyje | last post by:
I would like to create an application where I have many concurrent processes being managed by a monitoring process. Each process that is "managed" will be invoked from an assembly dll (think...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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:
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...
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...

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.