473,772 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding console with program compiled in PY2EXE

Hi all,

I know that to hide a console normally you simply change the extension
from .py to .pyw. That's simple enough. However I can't seem to
accomplish the same thing after freezing the program. I've tried
building the setup file with the python script as a .pyw file, but it
crashes and doesn't give me a reason. This is of course because the
debug window doesn't open, so you don't know what happened (ahh, the
irony).

Does anyone know how to successfully freeze a program with py2exe?

Many thanks,
Marc
Jul 18 '05 #1
3 6616
# setup.py
from distutils.core import setup
import py2exe

setup(name="con vertdpi",
scripts=["convertdpi.pyw "],
)
From the dos command prompt:
c:\python23> python.exe setup.py py2exe

This works for me.

Hope it helps,

Arjen
"Marc" <mn******@airma il.net> schreef in bericht
news:43******** *************** ***@posting.goo gle.com...
Hi all,

I know that to hide a console normally you simply change the extension
from .py to .pyw. That's simple enough. However I can't seem to
accomplish the same thing after freezing the program. I've tried
building the setup file with the python script as a .pyw file, but it
crashes and doesn't give me a reason. This is of course because the
debug window doesn't open, so you don't know what happened (ahh, the
irony).

Does anyone know how to successfully freeze a program with py2exe?

Many thanks,
Marc

Jul 18 '05 #2
duikboot wrote:
# setup.py
from distutils.core import setup
import py2exe

setup(name="con vertdpi",
scripts=["convertdpi.pyw "],
)
From the dos command prompt:
c:\python23> python.exe setup.py py2exe
Hi

or instead

# setup.py
from distutils.core import setup
import py2exe
setup(name="con vertdpi",
scripts=["convertdpi .py"],
)

c:\python23> python.exe setup.py py2exe -w

Which works for me :)

All options are described on http://starship.python.net/crew/theller/py2exe/

Regards
Jorgen


This works for me.

Hope it helps,

Arjen
"Marc" <mn******@airma il.net> schreef in bericht
news:43******** *************** ***@posting.goo gle.com...
Hi all,

I know that to hide a console normally you simply change the extension
from .py to .pyw. That's simple enough. However I can't seem to
accomplish the same thing after freezing the program. I've tried
building the setup file with the python script as a .pyw file, but it
crashes and doesn't give me a reason. This is of course because the
debug window doesn't open, so you don't know what happened (ahh, the
irony).

Does anyone know how to successfully freeze a program with py2exe?

Many thanks,
Marc



Jul 18 '05 #3
The way to prevent a py2exe program from throwing up
a console is to pass the '--windows' option to it.

i.e change your py2exe command line from

%python setup.py py2exe

to

%python setup.py py2exe --windows

HTH.

-Anand

mn******@airmai l.net (Marc) wrote in message news:<43******* *************** ****@posting.go ogle.com>...
Hi all,

I know that to hide a console normally you simply change the extension
from .py to .pyw. That's simple enough. However I can't seem to
accomplish the same thing after freezing the program. I've tried
building the setup file with the python script as a .pyw file, but it
crashes and doesn't give me a reason. This is of course because the
debug window doesn't open, so you don't know what happened (ahh, the
irony).

Does anyone know how to successfully freeze a program with py2exe?

Many thanks,
Marc

Jul 18 '05 #4

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

Similar topics

2
1656
by: Jerry chapman | last post by:
Several years ago I wrote a console program in Visual C++, which I am still using. In converting this program to C#, I have encountered the following problems: 1. I build my console display in a back ground buffer and use the function "SetConsoleActiveScreenBuffer(hForegroundBuffer)" to switch the console display to the new buffer. I couldn't find a corresponding function in C#. 2. I use the function...
8
1429
by: ZhangZQ | last post by:
How to make the Windows to run a console program during OS startup, like the Chkdsk program to do when the OS does not shutdown properly? Now I want to run my program instead of Chkdsk during the OS startup, is there a way to do that? Thank you very much! Regards,
3
1456
by: Thomas | last post by:
Hi, I have written a simple console program in VS2005 and it should run on computers that dosn't have .NET (not 1.1 and not 2.0). I think it depends on the headerfiles? I have exculded the default stuff (stdafx.h, stdafx.cpp). And I use the following headers: #include <shlwapi.h> #include <stdio.h> #include <stdarg.h> #include <vector>
5
2678
by: Marin | last post by:
Right now my solution to this is adding Console.ReadLine at the end but I'm wondering if it's possible to do it automatically? If I chose "Start without debug" it does just that, it pauses right before the console window closes, but "Start with debug" closes the window right away.
4
2519
by: JohnMoulding | last post by:
Hi, I'm a newbie, so apologies for missing the obvious... and I have searched for an answer to this question, but all I get is "how to call an external program from a C# program" - which is not what I'm looking for. I've written a C# console program that, after retrieving data from an SAP database, writes a simple (30 character) output string to a text file in a local directory. It works fine, and the fact that I can run it from the...
4
2525
by: =?Utf-8?B?Q1IgU3VwcG9ydA==?= | last post by:
Hi experts, We are trying to migrate from Visual Studio 6 (C++ project) on Windows 2000 to Visual Studio 2005 SP1 on Windows Vista but found that the migrated program runs slower in both OS. A looping section of the original program (compiled with VC6) running in Windows 2000 takes 400ms but the same program (compiled with VS 2005) in Windows Vista but copied to the Windows 2000 machine (together with the VC Redistribution libraries) to...
5
10776
by: =?Utf-8?B?SmFtZXMgV29uZw==?= | last post by:
Dear all, I'd like to know if there is any method to minimize command mode window when a console program is running. In my case, there are several console programs which run periodically in server. Now, every console program instance will open a command mode window and they occupy the whole screen. I want to minimize all of them and maximize it if neccessary by manual. Is it possible and how to do it? I'm using VB.NET 2005. ...
1
1183
by: Mufasa | last post by:
I used to work with somebody who wrote services that if you ran them from a console prompt with a -console it would run writing things to the screen as a normal console program. I'm sure he programmed this himself but I was wondering if anybody could give me guidance on how to do that. TIA - Jeff.
3
3369
by: PRR | last post by:
I have a console program.. which i need to convert to a windows service... My basic requirement is that the program needs to run in background and consume as less memory n CPU time as possible..I am not a expert in threading .. my guess was to create threads n execute them to give an example : public static Thread t2; public static Thread t11; i declared 2 static threads : which will call 2 function on start of service or in main of...
0
9620
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
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
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.