473,889 Members | 2,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

py2exe question

The py2exe says that a console app should have the --console option
and a windows app should have the --windows option.

What is the way to py2exe a python program that uses both console and
windows gui?

TIA

Al
Jul 18 '05 #1
10 4043
ac*****@easystr eet.com wrote:
The py2exe says that a console app should have the --console option
and a windows app should have the --windows option.

What is the way to py2exe a python program that uses both console and
windows gui?


Haven't tried, but logically it should be a console -- this doesn't restrict
what OTHER modules you can import, it just uses the equivalent of a .py
script run with python.exe rather than a .pyw run with pythonw.exe, i.e. a
"DOS box" console does appear when the program is run.
Alex

Jul 18 '05 #2
Alex Martelli wrote:

ac*****@easystr eet.com wrote:
The py2exe says that a console app should have the --console option
and a windows app should have the --windows option.

What is the way to py2exe a python program that uses both console and
windows gui?
Haven't tried, but logically it should be a console -- this doesn't restrict

what OTHER modules you can import, it just uses the equivalent of a .py
script run with python.exe rather than a .pyw run with pythonw.exe, i.e. a
"DOS box" console does appear when the program is run.


Logically, you don't need these switches. Outside of py2exe a *.py
gets a console and can open gui windows, a *.pyw is a pure gui
program. Why the switches atall? IDK? Thought I'd ask.

I'm having a little trouble getting a py2exe executable to run on
a machine wo python installed. Just wondered if this has anything to
do with it.
Al
Jul 18 '05 #3
ac*****@easystr eet.com wrote:
Alex Martelli wrote:

ac*****@easystr eet.com wrote:
> The py2exe says that a console app should have the --console option
> and a windows app should have the --windows option.
>
> What is the way to py2exe a python program that uses both console and
> windows gui?
> Haven't tried, but logically it should be a console -- this doesn't
> restrict what OTHER modules you can import, it just uses the equivalent of a .py
script run with python.exe rather than a .pyw run with pythonw.exe, i.e.
a "DOS box" console does appear when the program is run.


Logically, you don't need these switches. Outside of py2exe a *.py


Logically, maybe not, but if you have chosen to run Windows instead,
how do you avoid them? An EXE needs to let the OS know, via switches,
if it wants a console or not -- that's all there is to it.
gets a console and can open gui windows, a *.pyw is a pure gui
Not really: you can run either a .py or .pyw mainscript (and other
extensions yet) with either pyhon.exe or pythonw.exe. Which EXE
you choose to run as your interpreter is the one that either gets
a console or doesn't -- because Windows associates a console (or
lack thereof) with an EXE. By default most Python installers set
registry associations of the two extensions .py and .pyw with the
two interpreter executables in question -- that may be what's
confusing you. But that's just a default that determines what
the Windows GUI shell is going to do when you doubleclic a file
with such an extension, etc -- you can still perfectly well run
e.g. a .pyw mainscript with python.exe from a console (e.g. so you
can see error messages, warnings etc in the console window).
program. Why the switches atall? IDK? Thought I'd ask.
The switches let you control what goes on explicitly, just as
you can control it explicitly by choosing one or the other of
the two interpreters (python.exe or pythonw.exe) at a command
prompt. I don't know what you mean by the 'idk' question.
I'm having a little trouble getting a py2exe executable to run on
a machine wo python installed. Just wondered if this has anything to
do with it.


I don't see the connection.
Alex

Jul 18 '05 #4
The error I'm getting is in module imputil.pyo, line 601, in
import_file, module does not define init function initpywintypes2 3.

Please, can anyone tell what this means and how to fix?

TIA
Al
Jul 18 '05 #5
ac*****@easystr eet.com wrote:
The error I'm getting is in module imputil.pyo, line 601, in
import_file, module does not define init function initpywintypes2 3.

Please, can anyone tell what this means and how to fix?


A C-coded Python extension module named XXX _must_ define (and
export) a function named initXXX so that Python knows how to
initialize it. This error message means that a module named
pywintypes23.PY D (or .DLL) does exist, but fails to define and
export the needed function. You might double-check about the
module's existence - I can imagine anomalous cases where this
message (somewhat misleadingly) might end up being given for
modules that just don't exist, though I don't think py2exe could
cause such anomalies (but it's a while since I studied it).

If you _do_ find the pywintypes23.PY D you can check what it
does define-and-export -- but you need some tools for that
(I'm pretty sure there are downloadable ones though). But
fixing it sounds harder...
Alex

Jul 18 '05 #6
ac*****@easystr eet.com writes:
The error I'm getting is in module imputil.pyo, line 601, in
import_file, module does not define init function initpywintypes2 3.

Please, can anyone tell what this means and how to fix?


I think it has to do with the way win32all finds and loads the
PyWinTypes extension. Back in the past it was found via registry
entries, nowadays Mark Hammond changed it to be done without the
registry.

py2exe up to version 0.4.2 has not be adapted to this change, but the
0.5.0 alpha version (available in the files section of
http://sf.net/projects/py2exe) is able to handle this.

It requires Python 2.3 (because it uses the new zipimport feature), and
a fairly new win32all.

Thomas
Jul 18 '05 #7
Thomas Heller wrote:

py2exe up to version 0.4.2 has not be adapted to this change, but the
0.5.0 alpha version (available in the files section of
http://sf.net/projects/py2exe) is able to handle this.


Looks like 0.5.0a is not picking up any of my command line arguments
or producing any executable when I run it through the same batch
file that worked for 0.4.2.

Any docs on how to make if work?
Al
Jul 18 '05 #8
ac*****@easystr eet.com wrote in news:3F******** *******@easystr eet.com:
Thomas Heller wrote:

py2exe up to version 0.4.2 has not be adapted to this change, but the
0.5.0 alpha version (available in the files section of
http://sf.net/projects/py2exe) is able to handle this.

Looks like 0.5.0a is not picking up any of my command line arguments
or producing any executable when I run it through the same batch
file that worked for 0.4.2.

Any docs on how to make if work?


there is an example in the lib/site-packages/py2exe/samples dir
the syntax of the setup call is different

chris
--
Chris <cl******@gmx.n et>

Jul 18 '05 #9
Chris Liechti wrote:

ac*****@easystr eet.com wrote in news:3F******** *******@easystr eet.com:
Looks like 0.5.0a is not picking up any of my command line arguments
or producing any executable when I run it through the same batch
file that worked for 0.4.2.

Any docs on how to make if work?


there is an example in the lib/site-packages/py2exe/samples dir
the syntax of the setup call is different


I try to run the sample to see what comes out, and I get:

tlb = pythoncom.LoadR egTypeLib(typel ibCLSID, major, minor, lcid)
pywintypes.com_ error: (-2147319779, 'Library not registered.', None,
None)

I just installed win32all v161 last night.
Al
Jul 18 '05 #10

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

Similar topics

0
2998
by: RJS | last post by:
Hi all, I can't get a py2exe compiled app to run with numarray (numarray-0.5.win32- py2.2). Also wxPythonWIN32-2.3.3.1-Py22 and ActivePython-2.2.1-222. In the sample below, commenting out "import numarray" allows the exe to run. Left in, I get "4.exe has generated errors" etc. I'm going around and around and there isn't much on Google. py2exe output is last.
20
3713
by: Thomas Heller | last post by:
I'm currently working on a new version of py2exe, which will require Python 2.3 and later, because it uses the zipimport mechanism. Since py2exe is a distutils extension, and since C compilers are commonly available on most platforms except Windows, it would be fairly easy to let py2exe generate a C source file installing this import hook, and let distutils' C compiler build an executable file from this. Would this be useful, or would...
2
3678
by: Thomas Heller | last post by:
"Brad Clements" <bkc@murkworks.com> writes: > Once again I apologize for posting this py2exe question in the ctypes list. ;-) In the long run, this will be the wrong forum. I suggest comp.lang.python (or should a py2exe mailing list be created?). And I'm cc'ing to python-list. > > I need to ship a Windows service in py2exe, but I also want a
3
3653
by: ulysses | last post by:
hi. I use python 23,py2exe 0.4.3 ,wxpython do my py app in win32. I use gettext to support multi languages. I build a small fuction for load language at top of main module. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def setLan(lan): import gettext langs = gettext.GNUTranslations(open (join ( localPath, ( "lan/"+lan+".mo" ) )
5
1297
by: Thomas Heller | last post by:
**py2exe 0.5.4** released =================================== py2exe is a Python distutils extension which converts python scripts into executable windows programs, able to run without requiring a python installation. Console and Windows (GUI) applications, windows NT services, exe and dll COM servers are supported. Changes in this release:
17
3439
by: Thomas Heller | last post by:
py2exe 0.6.1 released ===================== py2exe is a Python distutils extension which converts python scripts into executable windows programs, able to run without requiring a python installation. Console and Windows (GUI) applications, windows NT services, exe and dll COM servers are supported. Changes in this release:
1
338
by: mitsura | last post by:
Hi, I just installed py2exe to create a binary of my Python script. However, py2exe does not seem to create a binary from my .py script. This is what I have done: I create a setup.py script: " # setup.py from distutils.core import setup import py2exe
4
1574
by: D | last post by:
I have a simple client/server file server app that I would like to convert to a single .exe. The client is just uses Tkinter and displays a simple GUI. The server has no GUI and just listens for and processes connections. How can I convert these 2 files to an .exe, while enabling the server app to register as a Windows service? Thanks. Doug
12
1694
by: chardish | last post by:
Hello, I'm trying to build an executable with py2exe, but unfortunately the version I have is 0.6.6, which has a rather annoying bug that doesn't let you rename the executable file if you bundle everything in a single executable. It seems fairly unacceptable to tell our customers that they can't rename a file we send them. I hear this problem is fixed in 0.6.8, but unfortunately there's no standalone installer for py2exe 0.6.8 - the...
0
9803
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
11187
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10783
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
10887
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
9598
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
7991
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
6021
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4248
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3252
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.