473,326 Members | 2,110 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,326 software developers and data experts.

Building Py2Exe from source

I need to be able to build Py2Exe from the source code as I am making
a Windows executable where I wish to preprocess the modules before
importing them.It looks like I can do this by adding lines to
Load_Module() in py2exe's start.c. However problem I have is that I
can't build Py2Exe using the instructions provided. Using the
designated command of "python setup.py install" I get this error:
Traceback (most recent call last):
File "setup.py", line 340, in ?
raise RuntimeError, msg
RuntimeError: PYWIN32DIR invalid.

To build py2exe from source, you must either:

- Download and build Mark Hammond's pywin32 source code
from http://starship.python.net/crew/mhammond, and set
the PYWIN32DIR variable to point to this directory

- or change this setup script to not build run_svc target,
then you will not be able to build Windows NT services
with py2exe.
The main problem I encountered is that the 2nd option appears
misleading: removing run_svc from the list of targets does no good as
it still attempts to find some sort of "win32" directory before it
even gets that far. Or maybe I'm missing something.

If option 1 requires following these arduous-looking instructions:
<http://starship.python.net/crew/mhammond/win32/BuildingExtensions.html>
then I'd rather bypass that if at all possible. :) I only need to
build standard executables, not DLLs, NT services, or anything to do
with COM.

Any help getting around this problem would be much appreciated.

(Platform: Win98SE, Python 2.3.3.)

--
Ben Sizer
Jul 18 '05 #1
2 2662
ky*****@hotmail.com (Kylotan) writes:
I need to be able to build Py2Exe from the source code as I am making
a Windows executable where I wish to preprocess the modules before
importing them.
Hm, is this really a good idea? py2exe includes the .pyc (or .pyo)
files, not the sources itself. Can't you preprocess them while building
the exe? This way you would only have to hack python-code, not C code...
It looks like I can do this by adding lines to
Load_Module() in py2exe's start.c. However problem I have is that I
can't build Py2Exe using the instructions provided. Using the
designated command of "python setup.py install" I get this error:
Traceback (most recent call last):
File "setup.py", line 340, in ?
raise RuntimeError, msg
RuntimeError: PYWIN32DIR invalid.

To build py2exe from source, you must either:

- Download and build Mark Hammond's pywin32 source code
from http://starship.python.net/crew/mhammond, and set
the PYWIN32DIR variable to point to this directory

- or change this setup script to not build run_svc target,
then you will not be able to build Windows NT services
with py2exe.
The main problem I encountered is that the 2nd option appears
misleading: removing run_svc from the list of targets does no good as
it still attempts to find some sort of "win32" directory before it
even gets that far. Or maybe I'm missing something.
You *should* be able to hack the py2exe setup-script to do this, only
removing run_svc from the list is certainly not enough.
Any help getting around this problem would be much appreciated.

(Platform: Win98SE, Python 2.3.3.)


Normally I would recommend the upcoming py2exe 0.5 for this, although it
does not yet run on Win98, but I'm working on it.

Thomas
Jul 18 '05 #2
Thomas Heller <th*****@python.net> wrote in message news:<oe**********@python.net>...
ky*****@hotmail.com (Kylotan) writes:
I need to be able to build Py2Exe from the source code as I am making
a Windows executable where I wish to preprocess the modules before
importing them.
Hm, is this really a good idea? py2exe includes the .pyc (or .pyo)
files, not the sources itself. Can't you preprocess them while building
the exe? This way you would only have to hack python-code, not C code...


One of my requirements is encryption of the pyc files. (I need -some-
degree of basic protection against decompyle and the like.) The file
in the archive needs to be encrypted and only decrypted when it comes
to be imported. This looks like only being about 3 or 4 lines of extra
C code (given a standalone encryption library) if put in the correct
place.
You *should* be able to hack the py2exe setup-script to do this, only
removing run_svc from the list is certainly not enough.
Sadly Python is my 2nd language, and these distutils scripts in
general are possibly the most complex (or at least idiosyncratic) code
that I've seen. I understand very little of it. :) And wouldn't know
where to start altering it.
Normally I would recommend the upcoming py2exe 0.5 for this, although it
does not yet run on Win98, but I'm working on it.


Ok. I don't need to do this urgently, but Win98SE is going to be both
a key development and deployment platform for me.

--
Ben Sizer
Jul 18 '05 #3

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

Similar topics

3
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....
2
by: Anthony Baxter | last post by:
I'm trying to use py2exe and Inno Setup to build an installer for shtoom, which uses tkinter. If I take the py2exe generated directory, and run the executable from there, it works fine. If I...
3
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...
1
by: Intaek LIM | last post by:
i'd tried to build my work with py2exe. my work consisted of: D:\temp\main.py D:\temp\ui\__init__.py (contains __all__= D:\temp\ui\dlg.py D:\temp\ui\dlgevent.py D:\temp\mymod\__init__.py...
0
by: Jimmy Retzlaff | last post by:
py2exe 0.6.4 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python...
0
by: Jimmy Retzlaff | last post by:
py2exe 0.6.5 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python...
0
bartonc
by: bartonc | last post by:
You can find the original author of the script by ggling " Py2Exe version 6.3 setup" The cool thing about this is that it calls py2exe, just in case you're uncomfortable with the command line. I had...
2
by: vedrandekovic | last post by:
Hello, Is there any solution for building exe file from python script something like bbfreeze.When user write some script in my program, it must compile script into exe without opening console...
5
by: Alexnb | last post by:
Hello I am sure most of you are familiar with py2exe. I am having a bit of a problem. See the program has a few pictures involved and the .ico it uses for the windows. However, the pictures are...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.