473,756 Members | 6,852 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

py2exe service and tool-tray app combined?

"Brad Clements" <bk*@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.pytho n (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
tool-tray control application (I'll make with venster or win32gui)

Naturally I want to save space. Can I do this with one .exe?

It's not clear from the project page what gets executed when the
service .exe is run without -debug or -register.
Well, you can try it out. But IIRC, nothing useful will happen. The
service tries to start, but cannot because it cannot connect to the
service manager (or something like that).
Can I have a single .py file that has win32serviceuti l.ServiceFramew ork subclass and the usual

if __name__ == "__main__":

And if I do this, how do I handle -register and -unregister?
I don't think so. But look into the C code run_svc.c to be sure.
Also, if anyone knows, I assume services don't run on 9x, so I want to 'simulate' a
service there by having the same .exe do all the work (and appear as a tooltray app),
so here's another reason for having one .exe

Can it be done?
Not sure. Best would be to change the win32all serviceutil framework.
But I'm not sure it makes sense nowadays - win98 is history.
--

And while I'm bugging the list, one thing I'd like to be able to do is
to split my application files into their own .zip distinct from 'the
python library .zip bolted onto the .exe'.
Well, I have something for you. As time permits, I'm working on a new
py2exe using the zipimport of Python 2.3. Still very much work in
progress, and services are not yet supported, but it's already in CVS in
a sandbox subdirectory.
That is, be able to define a group of .py files or packages that
should go into their own zip file outside the .exe, with that .zip
being inserted into sys.path before the .zip that's built into the
.exe
This py2exe (optionally) allows to create a number of console, gui exe
files, together with exe files implementing localserver and inproc COM
servers. The exe (or dll) files only contain the main script, or a
'boot' script for the com and service. The remaining code is loaded from
a shared zipfile.

This way, when I want to ship an 'upgrade' I most likely only need to
send a small .zip file instead of a gigantic .exe

So while declaring which packages or .py files are 'seperate' would be
a pain, I think this would be very handy for making easy-to-web-update
applications.

Comments?


This reminds me of how applications for Visual Smalltalk were
distributed. We had a small exe of only a could of kilobytes, this was
renamed into something like 'myapp.exe'. The classes neede were packed
into .sll files - smalltalk link libraries. And you had to provide a
'myapp.bnd' file which listed all the .sll files needed by 'myapp.exe'.

If you discovered a bug in an .sll file, you could either buid and
distribute a new version of it, or you could create an additional, new
..sll file containing the fixed methods. And you would make sure to list
this new .sll in the myapp.bnd file, before the buggy one. This way the
size of the upgrade could be kept as small as possible.

Now, isn't this '.bnd' file mechanism also a nice idea for py2exe?

Thomas
Jul 18 '05 #1
2 3673
Thomas Heller <th*****@python .net> schreef:
Also, if anyone knows, I assume services don't run on 9x, so I want
to 'simulate' a service there by having the same .exe do all the work
(and appear as a tooltray app), so here's another reason for having
one .exe

Can it be done?

You don't need a tooltray to create a pseudo service on Win9x.
<http://msdn.microsoft. com/library/en-us/win9x/95scm_28qb.asp>
Not sure. Best would be to change the win32all serviceutil framework.
But I'm not sure it makes sense nowadays - win98 is history.


I know multinational companies that use Win98SE as their standard desktop
OS (one of them upgraded from Win95 last year). As they want to use the
same "environmen t" in every part of the world and on everything from new P4
desktops to old P2 laptops, Win2K/XP isn't an option...

--
JanC

"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9
Jul 18 '05 #2
(moved from ctypes list)

I've taken a look at the py2exe source. What I'd like to do is combine the
functionality of run_svc.c with that of run_w.c

So for example, could I simply change run_svc.c

int main (int argc, char **argv)
{
int result;
result = init();
if (result)
return result;

if(1 < argc && !stricmp(argv[1], "-x"))
return start(argc, argv)
else
return PythonService_m ain(argc, argv);
}
Then link in start.c in addition to PythonService.c pp ?

This way, the generated exe could work as both a service, and a regular
application just by passing -x as the first command line option, or some
other well-defined sentinel.

I don't have the win32 source, so it's not easy for me to try. Anyone know
off-hand if start.c exports items that will collide with PythonService.c pp?

Jul 18 '05 #3

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

Similar topics

0
2991
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
3697
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...
5
4022
by: Rene Olsthoorn | last post by:
Dear readers, py2exe has a problem including libxml2. Not at building time, but at runtime. The libxml2.dll cannot be loaded... Is there anyone that NOT has the problem? (and can you drop me your setup.py scipt, please). Thanks in advance, Rene O.
5
3981
by: Brian Hlubocky | last post by:
I'm have a fairly simple (in terms of COM) python program that pulls info from an Access database and creates Outlook contacts from that information. It uses wxPython for gui and works without problems. I want to be able to distribute this program using py2exe, but I am having some problems. I am using a simple setup.py like in the documentation for the py2exe tool and everything compiles ok, except that when I run the exe, I get an...
1
3769
by: Peter Teniz | last post by:
hi, i'm trying to generate a service for win XP / win 2k with python2.3.3 + win32all-163 + py2exe0.5.0 (also tried with pywin32-200.win32-py2.3) running the console-script "FBxmlserv.py" with python-interpreter and as EXE-prog goes well. running the service-module "FBservice.py" with python-interpreter also works fine but after comiling with py2exe (with no warnings or errors!) i get on every host the same error message
3
5724
by: Werner Merkl | last post by:
Hi, Python is really great, for small to big programs. For my colleagues and some circumstances I sometimes need to "compile" a script using py2exe. Cause I use Windows, I like to use the (Windows) ability, to add some version infos, comments, etc to the exe file. If I use explorer to check, these properties are visible and correct.
0
1312
by: Thomas Heller | last post by:
**py2exe 0.5.2** 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. This is a bugfix release.
4
1568
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
2
4147
by: Maria.Reinhammar | last post by:
I have an app using active_directory.py and the std module asyncore in a Windows Service. Works perfectly! That is, until I try to use py2exe to create a standalone (need to avoid installing the entire Python etc. on the target system). When I try to start the installed Service, the system tells me it terminates prematurely and in the event log I find: The instance's SvcRun() method failed
9
3640
by: Isaac Rodriguez | last post by:
Hi, I am looking for feedback from people that has used or still uses Py2Exe. I love to program in python, and I would like to use it to write support tools for our development team, but I cannot require everyone to install python in their machines, so I was thinking that Py2Exe would help on that. The support tools I write are mostly command line driven (no GUI), but in the future, I would like to write some expert applications that...
0
9973
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...
1
9779
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
9645
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
8645
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
7186
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
6473
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
5069
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...
2
3276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2612
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.