Results 1 to 5 of 5

Thread: How to turn a .py script into an .exe file?

  1. #1
    Join Date
    Aug 2006
    Posts
    221

    How to turn a .py script into an .exe file?

    Hi Guys,
    I am trying to convert a .py script into an .exe file but not succeeding. Does anyone know how to convert a .py script into an .exe file.? Also please tell me some basic programs since I am new to the python scripts. Please help me soon by providing some useful information..!!
    AMD Sempron 2800+ @ 2Ghz
    Asus A7V8X-LA
    120Gb Seagate barracuda 7200Rpm Ultra-ATA 100
    Elixir 512mb DDR Pc3200 (Soon 1Gb)
    Club 3D Radeon 9600 256Mb
    Lite-On Cd & Dvd writer combo
    IDE-Dvd drive
    400w Psu
    Windows Xp Pro Sp2
    Advent Wireless Mouse & Keyboard.

  2. #2
    Join Date
    Nov 2008
    Posts
    996

    Re: How to turn a .py script into an .exe file?

    You can use the py2exe application for converting the python scripts into standalone windows programs. The main advantage of this application is that py2exe is a Python extension which converts python scripts into executable windows programs, able to run without requiring a python installation. So even if you are not having the python installation, then also you can make the python scripts into executable files. py2exe is distributed under an open-source license. Hope that you can use the py2exe application and then your problem is solved.!!

  3. #3
    Join Date
    Mar 2008
    Posts
    349

    Re: How to turn a .py script into an .exe file?

    For converting a .py script into an .exe file you will have to install py2exe. After installing it make sure that your python program is running from command prompt. For checking that from the command prompt type the following command in the command prompt :
    Code:
    C:\Documents and Settings\atik>python sample.py
    Otherwise you will have to create setup script and you can do that typing the following code into your editor :
    Code:
    from distutils.core import setup
    import py2exe
    setup(console=[‘sample.py’])
    Then run the python program as mentioned in above coding.

  4. #4
    Join Date
    Mar 2008
    Posts
    672

    Re: How to turn a .py script into an .exe file?

    According to me, the vast majority of things you can do with Python will work with py2exe. It's important that you make sure everything is working before you use py2exe. Here is the basic example of "Hello World" :
    Code:
    print "Hello World!"
    For making it sure that it is working properly, you can check by the following command :
    Code:
    C:\Tutorial>python hello.py
    Hello World!
    
    C:\Tutorial>

  5. #5
    Join Date
    Aug 2006
    Posts
    235

    Re: How to turn a .py script into an .exe file?

    Python is a simple and powerful language for scripting and even application development. The following code prints a header and numbers 1 to 10 to console output :
    Code:
    print "Python script to exe test program"
    
    count = 0
    
    while count < 10:
        print "count = " + str(count) +"\n"
        count = count + 1
    Save this code in to trial.py file. Make sure that the code works fine by running it using python. To do this, on command prompt type "python trial.py".
    3.2 (northwood)
    2gig ram
    ATI AIW X800xt 256mb
    Gigabyte GA-8knxp 875p Chipset
    Optiwrite 8X DVD Burner
    Win XP PRO Sp2 (Works Perfectly)
    2 SATA Raptor 74gig Raid 0
    2 7200 IDE 320gig HD

Similar Threads

  1. Replies: 3
    Last Post: 17-08-2010, 09:06 PM
  2. creating a script for a host file
    By mopat in forum Technology & Internet
    Replies: 1
    Last Post: 07-07-2010, 11:44 PM
  3. How to create an empty file in a script?
    By OmJaa in forum Windows XP Support
    Replies: 2
    Last Post: 26-05-2010, 09:47 PM
  4. Bat file for logon script
    By adam2010 in forum Windows Software
    Replies: 1
    Last Post: 10-05-2010, 11:42 AM
  5. automatic script to delete file
    By Hardik in forum Software Development
    Replies: 4
    Last Post: 06-04-2009, 10:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,630,300.70318 seconds with 17 queries