Re: [pygame] py2exe, MSVCR71.dll and InnoSetup

2010-10-29 Thread Brian Fisher
There is no real problem here - this old concern of illegally distributing
MSVCR71.dll with python has always been fear, uncertainty and doubt with no
real foundation for concern.

If you are distributing MSVCR71.dll along with python (which you are), the
license that allows the python developers to distribute it with python
(which they do) allows you to then redistribute python and msvcr71.dll along
with it, provided you comply with the license terms - which mostly amounts
to you distributing your stuff with a license which is compatible with the
original msvcr71.dll terms with respect to that dll, which means you're not
giving your end-users any rights to distribute it independent of your
product.

Basically, for the microsoft redistributable license to actually be useful
to developers, it had to allow developers to give their product including
the redistributable to others, and then allow those other people to
redistribute the product. This is essential for being able to sell stuff in
a store, and it's essential for being able to make a library or engine type
of product. This happens with the microsoft c-run time dlls in hundreds and
hundreds of products all over the world, and microsoft never sued any of
them. Your case is not likely to be any different.

A better question is probably "what do I have to avoid to comply with the
msvcr71.dll redistributable license", and on that side, the only thing you
clearly can't do, is provide license terms that imply people can do whatever
they want with msvcr71.dll, so don't do that. If you are the worrying type
though, then dig up the original redistributable license from msvcr71.dll,
and include that in your product. If you are the worrying type and the
skeptical type, then also download the free msvc toolkit 2003 or buy visual
studio 2003, so that now microsoft is licensing the dll to you as a
redistributable, and then you can do what you want. If that's not good
enough for you, then have fun wasting your time with installer gymnastics.


On Mon, Oct 25, 2010 at 12:16 PM, Johannes Charra wrote:

>
> Hi,
>
> How do I distribute my Python game to Windows users without illegally
> distributing the MSVCR71.dll?
>
> As far as my research went, one might e.g. build an InnoSetup installer
> which will include the installation of the MS Visual C++ 2005
> Redistributable package. I tried that, but my game still won't run because
> the DLL cannot be found.
>
> I'd be grateful for any comments on how you're solving the general
> MSVCR71.dll problem.
>
> Furthermore, if anyone is going the same way as I do (InnoSetup + MS
> package installation), maybe he or she can give me a hint on how to make
> InnoSetup copy the DLL to my app directory after installing the redist
> package.
>
> Best regards,
> Johannes


[pygame] py2exe, MSVCR71.dll and InnoSetup

2010-10-25 Thread Johannes Charra

Hi,

How do I distribute my Python game to Windows users without illegally 
distributing the MSVCR71.dll?

As far as my research went, one might e.g. build an InnoSetup installer which 
will include the installation of the MS Visual C++ 2005 Redistributable 
package. I tried that, but my game still won't run because the DLL cannot be 
found.

I'd be grateful for any comments on how you're solving the general MSVCR71.dll 
problem.

Furthermore, if anyone is going the same way as I do (InnoSetup + MS package 
installation), maybe he or she can give me a hint on how to make InnoSetup copy 
the DLL to my app directory after installing the redist package.

Best regards,
Johannes

[pygame] py2exe oceangui problem

2009-04-07 Thread David Gustafson
I'm having a problem and I wonder if anyone has any insight.  I have a
program that works runs properly but when I use py2exe to create an
executable and then attempt to run that executable from the dist dir I
get:

D:\code\test\dist>twisted_ocean_client.exe
D:\code\test\dist\library.zip\twisted\spread\pb.py:30:
DeprecationWarning: the md5 module is deprecated; use hashlib instead
D:\code\test\dist\library.zip\ocempgui\draw\String.py:71:
RuntimeWarning: use font: DLL load failed: The specified module could
not be found
.
Traceback (most recent call last):
  File "twisted_ocean_client.py", line 279, in 
  File "twisted_ocean_client.py", line 227, in __init__
  File "twisted_ocean_client.py", line 239, in drawButton
  File "ocempgui\widgets\Button.pyc", line 83, in __init__
  File "ocempgui\widgets\Button.pyc", line 97, in set_text
  File "ocempgui\widgets\Label.pyc", line 124, in __init__
  File "ocempgui\widgets\Label.pyc", line 158, in set_text
  File "ocempgui\widgets\BaseWidget.pyc", line 961, in 
  File "ocempgui\widgets\BaseWidget.pyc", line 527, in set_dirty
  File "ocempgui\widgets\BaseWidget.pyc", line 875, in update
  File "ocempgui\widgets\BaseWidget.pyc", line 792, in draw
  File "ocempgui\widgets\Label.pyc", line 318, in draw_bg
  File "D:\Python26\share\ocempgui\themes\default\DefaultEngine.py",
line 682, in draw_label
rtext = self.draw_string (label.text, label.state, cls, st)
  File "D:\Python26\share\ocempgui\themes\default\DefaultEngine.py",
line 287, in draw_string
return String.draw_string (text, name, size, alias, color, st)
  File "ocempgui\draw\String.pyc", line 169, in draw_string
  File "ocempgui\draw\String.pyc", line 135, in create_font
  File "ocempgui\draw\String.pyc", line 71, in create_file_font
  File "pygame\__init__.pyc", line 70, in __getattr__
NotImplementedError: font module not available

D:\code\test\dist>


Here is the code it is compiling and I can run it directly with python.
--


import pygame
import sys
from pygame import QUIT, event
from pygame import error as PygameError
from pygame import time as PygameTime

from random import randint

from ocempgui.widgets import *
from ocempgui.widgets.Constants import *
from ocempgui.object import BaseObject

from ocempgui.widgets import Button, Renderer
from twisted.internet._threadedselect import install
install()
from twisted.spread import pb
from twisted.internet import reactor

REPORT = pygame.locals.USEREVENT + 4
SCORE = pygame.locals.USEREVENT + 5

def main_loop():
events = pygame.event.get ()
for ev in events:
if ev.type == pygame.QUIT:
sys.exit ()

re.distribute_events (*events)
re.refresh ()
pygame.time.delay (15)


class CustomTwistedRenderer (Renderer):
"""TwistedRenderer () -> TwistedRenderer

A Renderer that allows the easy integration with Twisted.

Because Twisted's threadedselectreactor *must* be shut down before
the main loop shuts down, this Renderer will keep running until
explicitly told to stop.

Before starting the main loop, this Renderer will check to see if it
has a Twisted reactor attached to it. This is an attribute set like
any of the normal Renderer attributes:

self.reactor = reactor

If self.reactor is None (default), this will behave like a normal
Renderer. If self.reactor has been set, the QUIT signal will call
reactor.stop(), and then wait for reactor.addSystemEventTrigger to
call self.stop(). This function will then stop the main loop.

Usage
-
Install the threadedselectreactor instead of the default reactor:

from twisted.internet.threadedselectreactor import install
install()
from twisted.internet import reactor

In the main section of your program, where you create the Renderer,
just set TwistedRenderer's reactor:

re = TwistedRenderer()
re.reactor = reactor

Everything else is handled internally by TwistedRenderer.

Attributes:
reactor - The twisted reactor attached to the TwistedRenderer.
"""
def __init__ (self):
Renderer.__init__ (self)
self._reactor = None
self._running = False

def start (self):
"""T.start () -> None

Overrides default start() to use self._running. If a reactor is
attached, interleave self.waker
"""
self._running = 1
if self._reactor != None:
self._reactor.interleave (self.waker)
self._loop()

def stop (self):
"""T.stop () -> None

Tells the internal loop to stop running.
"""
self._running = False

def set_reactor (self, reactor):
"""T.set_reactor (...) -> None

Sets the internal reactor.
"""
if not hasattr (reactor, 'interleave'):
raise AttributeError ("interleave() method not found in %s" %
  reactor)
self._reactor = reactor
self._reactor.addSystemEventTrigger ('after', 

Re: [pygame] py2exe and pygame font causes segfaults

2008-12-30 Thread Jake b
On Tue, Dec 30, 2008 at 1:11 PM, Ian Mallett  wrote:

> Using the pygame default font in py2exe doesn't work for some reason.
> You'll have to include the file in your distribution yourself and use
> pygame.font.Font().  Also remember to include *all* your data files in the
> distr folder py2exe makes too.
>
> Ian
>
I heard about that, so before I posted I copied the ttf file into a
subdirectory relative my main.py script. ( its in
./data/ttf/freesandsbold.ttf )

And code:
self.font_path = os.path.join('.', 'data','ttf','freesansbold.ttf')
self.font = pygame.font.Font(self.font_path, 18)

And I get the parachute in my first post.
-- 
Jake


Re: [pygame] py2exe and pygame font causes segfaults

2008-12-30 Thread pymike
Because the Font path is in the Python/lib/site-packages/pygame dir, so if
Python isn't installed the font doesn't exist =)

On Tue, Dec 30, 2008 at 1:11 PM, Ian Mallett  wrote:

> Using the pygame default font in py2exe doesn't work for some reason.
> You'll have to include the file in your distribution yourself and use
> pygame.font.Font().  Also remember to include *all* your data files in the
> distr folder py2exe makes too.
>
> Ian
>



-- 
- pymike
"Python eggs me on."


Re: [pygame] py2exe and pygame font causes segfaults

2008-12-30 Thread Ian Mallett
Using the pygame default font in py2exe doesn't work for some reason.
You'll have to include the file in your distribution yourself and use
pygame.font.Font().  Also remember to include *all* your data files in the
distr folder py2exe makes too.

Ian


[pygame] py2exe and pygame font causes segfaults

2008-12-30 Thread Jake b
I have a game that I want to package using py2exe. I compile it, and
seems fine, but I run it and I get:

"""
Fatal Python error: (pygame parachute) Segmentation Fault

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
"""

However, if I run it as normal python script, it works fine.

[ If I rename the freesansbold.ttf to something else, it end with
"IOError: unable to read font filename" as expected. ]

So I set a boolean to toggle all font creation/blits/etc... -- If it
is off, the .exe runs fine. If it is on, it fails with above error.

If I run python script , it runs fine with text on.



Any ideas?
--
Jake


Re: [pygame] py2exe

2008-05-12 Thread OsKaR
Eeehm I think I've solved the problem, at least I've found the way to
execute it. I've used your script to make the executable file before, but
when I tried to see the help with >my_program.exe --help   It has been open
and ran perfectly.
I have to take a look at this but while I will using this "trick"
Searching on google I found a lot of people that have this problem, but no
solution has gone.
Thanks!

2008/5/12 PyMike <[EMAIL PROTECTED]>:

> Hi OsKaR
>
> First make sure there's no errors in the program.  Check to see if there
> is a file called "your_program's_name.exe.txt" that has an error log in it.
>
> Another possible problem is that the exe is compiling it funny or
> something. Can you post your py2exe script?
>
> I've made a py2exe script that you might be interested in trying out:
> http://pymike93.googlepages.com/PySetup.py
> Let me know if it runs ok after compiling with that.
>
> HTH,
>
>
> On Mon, May 12, 2008 at 4:46 PM, OsKaR <[EMAIL PROTECTED]> wrote:
>
> > Hi all!
> > Well I'm some relatively new on python and pygame but I've been working
> > on a simple tanks game, but today I've tried to make an exe file with py2exe
> > and everything seems ok but when I try to execute my .exe file appears a
> > black window and then nothing, It simply closes and that's all. What's the
> > matter?
> > And how can I solve that?
> >
> > Thank you all!
> >
> > Sorry for my english I'm spanish and maybe there was a lot of gramatical
> > mistakes, hope that you understand!
> >
>
>
>
> --
> - pymike (http://pymike.aftermatheffect.com/)


Re: [pygame] py2exe

2008-05-12 Thread PyMike
Hi OsKaR

First make sure there's no errors in the program.  Check to see if there is
a file called "your_program's_name.exe.txt" that has an error log in it.

Another possible problem is that the exe is compiling it funny or something.
Can you post your py2exe script?

I've made a py2exe script that you might be interested in trying out:
http://pymike93.googlepages.com/PySetup.py
Let me know if it runs ok after compiling with that.

HTH,

On Mon, May 12, 2008 at 4:46 PM, OsKaR <[EMAIL PROTECTED]> wrote:

> Hi all!
> Well I'm some relatively new on python and pygame but I've been working on
> a simple tanks game, but today I've tried to make an exe file with py2exe
> and everything seems ok but when I try to execute my .exe file appears a
> black window and then nothing, It simply closes and that's all. What's the
> matter?
> And how can I solve that?
>
> Thank you all!
>
> Sorry for my english I'm spanish and maybe there was a lot of gramatical
> mistakes, hope that you understand!
>



-- 
- pymike (http://pymike.aftermatheffect.com/)


[pygame] py2exe

2008-05-12 Thread OsKaR
Hi all!
Well I'm some relatively new on python and pygame but I've been working on a
simple tanks game, but today I've tried to make an exe file with py2exe and
everything seems ok but when I try to execute my .exe file appears a black
window and then nothing, It simply closes and that's all. What's the matter?

And how can I solve that?

Thank you all!

Sorry for my english I'm spanish and maybe there was a lot of gramatical
mistakes, hope that you understand!


Re: [pygame] py2exe problems

2008-03-24 Thread Brian Fisher
There's no flag - but you can register your own python error checking
function with PyOpenGL 3.x:
  from OpenGL import error
  error.ErrorChecker.registerChecker( myAlternateFunction )
either an empty function or possibly None will disable the glGetError
call. Note that depending on the card/driver most of the glGetError
slowness can have nothing to do with python, so there can be real
benefit to disabling error checking entirely. I'm not aware of a
similar feature with PyOpenGL 2.x.

However for my particular uses, I don't want to disable error checking
- I just want the cheapest error checking I can get, which is
something I like about 2.x.


On Mon, Mar 24, 2008 at 4:29 PM, René Dudfield <[EMAIL PROTECTED]> wrote:
>  I think there is a way to disable the error checking with a flag
>  somehow with 3.x... or if there isn't there should be.
>
>
>
>
>  On Mon, Mar 24, 2008 at 7:02 PM, Brian Fisher <[EMAIL PROTECTED]> wrote:
>  > Hey all,
>  >   after a long period of frustration with PyOpenGL 3.x and py2exe not
>  >  working, I solved my problems by building PyOpenGL 2.0.1.9 for Python
>  >  2.5 on windows (I labeled it as PyOpenGL 2.1.0 to be distinct):
>  >
>  >  http://thorbrian.com/pyopengl/builds.php
>  >
>  >  It has no numeric support, and it doesn't include TOGL (tcl/tk +
>  >  PyOpenGL) but it works just as well as PyOpenGL ever did besides, and
>  >  it works with py2exe out of the box (no more "version" file hack). And
>  >  being a compiled SWIG wrapper (like all pyopengl 2.x) it is able to
>  >  raise an exception for glGetError errors after every call with minimal
>  >  overhead (as opposed to PyOpenGL 3.x and pyglet - both of which use
>  >  ctypes)
>  >
>  >  I will be using it to build my exe's for pyweek (I believe it meets
>  >  the letter and spirit of the compo given that it is just PyOpenGL
>  >  2.0.1.9 which has been out for like forever)
>  >
>  >
>  >
>  >
>  >  On Sun, Mar 16, 2008 at 4:01 PM, Brian Fisher <[EMAIL PROTECTED]> wrote:
>  >  >  At the moment I'm thinking that PyOpenGL 2.0 is for me (it's compiled
>  >  >  C code, no ctypes), all it needs is a python 2.5 windows installer, so
>  >  >  I'm gonna try and tackle that (I want to be able to build exe's for
>  >  >  pyweek...)
>  >  >
>  >
>


Re: [pygame] py2exe problems

2008-03-24 Thread René Dudfield
Nice one.

I think there is a way to disable the error checking with a flag
somehow with 3.x... or if there isn't there should be.


On Mon, Mar 24, 2008 at 7:02 PM, Brian Fisher <[EMAIL PROTECTED]> wrote:
> Hey all,
>   after a long period of frustration with PyOpenGL 3.x and py2exe not
>  working, I solved my problems by building PyOpenGL 2.0.1.9 for Python
>  2.5 on windows (I labeled it as PyOpenGL 2.1.0 to be distinct):
>
>  http://thorbrian.com/pyopengl/builds.php
>
>  It has no numeric support, and it doesn't include TOGL (tcl/tk +
>  PyOpenGL) but it works just as well as PyOpenGL ever did besides, and
>  it works with py2exe out of the box (no more "version" file hack). And
>  being a compiled SWIG wrapper (like all pyopengl 2.x) it is able to
>  raise an exception for glGetError errors after every call with minimal
>  overhead (as opposed to PyOpenGL 3.x and pyglet - both of which use
>  ctypes)
>
>  I will be using it to build my exe's for pyweek (I believe it meets
>  the letter and spirit of the compo given that it is just PyOpenGL
>  2.0.1.9 which has been out for like forever)
>
>
>
>
>  On Sun, Mar 16, 2008 at 4:01 PM, Brian Fisher <[EMAIL PROTECTED]> wrote:
>  >  At the moment I'm thinking that PyOpenGL 2.0 is for me (it's compiled
>  >  C code, no ctypes), all it needs is a python 2.5 windows installer, so
>  >  I'm gonna try and tackle that (I want to be able to build exe's for
>  >  pyweek...)
>  >
>


Re: [pygame] py2exe problems

2008-03-24 Thread Brian Fisher
Hey all,
  after a long period of frustration with PyOpenGL 3.x and py2exe not
working, I solved my problems by building PyOpenGL 2.0.1.9 for Python
2.5 on windows (I labeled it as PyOpenGL 2.1.0 to be distinct):

http://thorbrian.com/pyopengl/builds.php

It has no numeric support, and it doesn't include TOGL (tcl/tk +
PyOpenGL) but it works just as well as PyOpenGL ever did besides, and
it works with py2exe out of the box (no more "version" file hack). And
being a compiled SWIG wrapper (like all pyopengl 2.x) it is able to
raise an exception for glGetError errors after every call with minimal
overhead (as opposed to PyOpenGL 3.x and pyglet - both of which use
ctypes)

I will be using it to build my exe's for pyweek (I believe it meets
the letter and spirit of the compo given that it is just PyOpenGL
2.0.1.9 which has been out for like forever)


On Sun, Mar 16, 2008 at 4:01 PM, Brian Fisher <[EMAIL PROTECTED]> wrote:
>  At the moment I'm thinking that PyOpenGL 2.0 is for me (it's compiled
>  C code, no ctypes), all it needs is a python 2.5 windows installer, so
>  I'm gonna try and tackle that (I want to be able to build exe's for
>  pyweek...)
>


Re: [pygame] py2exe problems

2008-03-16 Thread Brian Fisher
I've been trying a ton of things with PyOpenGL 3.0 - installing setup
tools unzipped, pyopengl unzipped, with py2exeeggs.py and without - in
the end I keep getting the same error with the 3.0 beta:
RuntimeError: Unable to find an implementation for the 'win32' ('nt') platform

If I try to go back to the alpha I get:
TypeError: No array-type handler for type 
(value: c_ulong(0L)) registered

At the moment I'm thinking that PyOpenGL 2.0 is for me (it's compiled
C code, no ctypes), all it needs is a python 2.5 windows installer, so
I'm gonna try and tackle that (I want to be able to build exe's for
pyweek...)

On Sun, Mar 16, 2008 at 3:49 PM, Ian Mallett <[EMAIL PROTECTED]> wrote:
> In this case, the error I get, using the py2exeeggs.py is:
>
> C:\Users\Ian\Desktop\OpenGL Test Program\dist>OpenGLTestProgram.exe
>
> Traceback (most recent call last):
>   File "OpenGL Test Program.py", line 2, in 
>File "py2exeeggs.pyc", line 43, in loadEggs
> AttributeError: 'module' object has no attribute 'Environment'
>


Re: [pygame] py2exe problems

2008-03-16 Thread Ian Mallett
In this case, the error I get, using the py2exeeggs.py is:

C:\Users\Ian\Desktop\OpenGL Test Program\dist>OpenGLTestProgram.exe
Traceback (most recent call last):
  File "OpenGL Test Program.py", line 2, in 
  File "py2exeeggs.pyc", line 43, in loadEggs
AttributeError: 'module' object has no attribute 'Environment'


Re: [pygame] py2exe problems

2008-03-16 Thread Ian Mallett
On Sun, Mar 16, 2008 at 3:38 PM, Ken Seehart <[EMAIL PROTECTED]> wrote:

> Did you try running your exe in a shell?  That way you might get to see
> the error message.

Yes, that is how I knew about the font problem, and was able to rectify it
for my release.  However, OpenGL programs still do not run...

> Ken

Ian


Re: [pygame] py2exe problems

2008-03-16 Thread Ken Seehart

Ian Mallett wrote:

New problem.
My program (which only uses pygame) doesn't run when py2exe'd.  It 
says something about not being able to find the surfarray module when 
the .exe is run, but it closes almost instantly, so I can't really 
tell.  I upgraded to pygame 1.8, if that makes a difference.

Ian
Did you try running your exe in a shell?  That way you might get to see 
the error message.

Ken



Re: [pygame] py2exe problems

2008-03-15 Thread Ian Mallett
Nope.
This is the parabola one:
http://www.geometrian.com/Programs/Parabola4exe.zip
It only uses pygame.  OpenGL still doesn't work.


Re: [pygame] py2exe problems

2008-03-15 Thread Brian Fisher
so do you use PyOpenGL from that program? does the program work completely now?

On Sat, Mar 15, 2008 at 6:20 PM, Ian Mallett <[EMAIL PROTECTED]> wrote:
> I solved my problem by loading the font file from the program:
> Font = pygame.font.Font("freesansbold.ttf",12)
> or something, then adding the relevant file to the finished directory.
> Ian
>


Re: [pygame] py2exe problems

2008-03-15 Thread Ian Mallett
I solved my problem by loading the font file from the program:
Font = pygame.font.Font("freesansbold.ttf",12)
or something, then adding the relevant file to the finished directory.
Ian


Re: [pygame] py2exe problems

2008-03-15 Thread Brian Fisher
That problem has popped up on the mailing list a lot - a ton really...
I don't know of a good way to solve this problem for people long term
(i.e. make sure that py2exe includes the font - although if py2exe
supported eggs I suppose they could do it), but I think if
freesansbold.ttf was in your library.zip next to font.pyd it would
probably load.

...but I avoid this problem by not using the default font and having a
"data_files" entry in my setup call for py2exe building for whatever
fonts I do use.


On Sat, Mar 15, 2008 at 4:17 PM, Ian Mallett <[EMAIL PROTECTED]> wrote:
> --exclude Numeric,Numpy makes something that doesn't crash immediately.
> It cannot, however, find the default pygame font.  Why?
>


Re: [pygame] py2exe problems

2008-03-15 Thread Ian Mallett
--exclude Numeric,Numpy makes something that doesn't crash immediately.
It cannot, however, find the default pygame font.  Why?


Re: [pygame] py2exe problems

2008-03-15 Thread Ian Mallett
--exclude
?


Re: [pygame] py2exe problems

2008-03-15 Thread Ian Mallett
Well, my program doesn't use Numpy or Numeric.  I just used:
from pygame.locals import *.
The program is: http://www.pygame.org/project/670/?release_id=1167
How can one make py2exe not consider numeric, etc.?
Ian


Re: [pygame] py2exe problems

2008-03-15 Thread Brian Fisher
That error looks very google-able now - I found this thread that seems related:
http://www.gossamer-threads.com/lists/python/python/629815?page=last

According to it, the problem seems to be that line 9 of numeric's precision.py:
---
from multiarray import zeros
---
imports numeric's multiarray when run normally, but for some reason
py2exe thinks the multiarray there should belong to numpy, and
includes it's version instead of numeric's. And the numpy's multiarray
doesn't like the numeric typecodes being passed to it.

I imagine this problem would happen to anyone who has both numpy and
numeric installed and then py2exe's a numeric using script.

The best thing would be to figure out how py2exe gets confused and
patch it so it's fixed for people in the future. As a workaround, you
could temporarily remove numpy or maybe tell py2exe to ignore numpy.

It might also be possible to modify the numeric source to explicitly
load it's own multiarray... maybe change the line in precision.py to
something like this:
---
from numeric.multiarray import zeros


On Sat, Mar 15, 2008 at 11:42 AM, Ian Mallett <[EMAIL PROTECTED]> wrote:
> C:\dev\Python25\Projects\Pygame Programs\Parabola\4\dist>Parabola4.exe
> Traceback (most recent call last):
>   File "Parabola 4.py", line 1, in 
>   File "pygame\__init__.pyc", line 159, in 
>File "pygame\surfarray.pyc", line 68, in 
>   File "pygame\_numericsurfarray.pyc", line 12, in 
>   File "pygame\_numericsurfarray.pyc", line 10, in __load
>File "Numeric.pyc", line 93, in 
>   File "Precision.pyc", line 26, in 
>   File "Precision.pyc", line 23, in _fill_table
>   File "Precision.pyc", line 18, in _get_precisions
>  TypeError: data type not understood
>


Re: [pygame] py2exe problems

2008-03-15 Thread FT

Ian,


This error sounds like a wrong revision level or change in the data type 
structure, usually related to revision levels. So probably it was not compiled 
correctly or just the wrong revision level.

Ian Sent:
C:\dev\Python25\Projects\Pygame Programs\Parabola\4\dist>Parabola4.exe
Traceback (most recent call last):
  File "Parabola 4.py", line 1, in 
  File "pygame\__init__.pyc", line 159, in 
  File "pygame\surfarray.pyc", line 68, in 
  File "pygame\_numericsurfarray.pyc", line 12, in 
  File "pygame\_numericsurfarray.pyc", line 10, in __load
  File "Numeric.pyc", line 93, in 
  File "Precision.pyc", line 26, in 
  File "Precision.pyc", line 23, in _fill_table
  File "Precision.pyc", line 18, in _get_precisions
TypeError: data type not understood



Re: [pygame] py2exe problems

2008-03-15 Thread Ian Mallett
C:\dev\Python25\Projects\Pygame Programs\Parabola\4\dist>Parabola4.exe
Traceback (most recent call last):
  File "Parabola 4.py", line 1, in 
  File "pygame\__init__.pyc", line 159, in 
  File "pygame\surfarray.pyc", line 68, in 
  File "pygame\_numericsurfarray.pyc", line 12, in 
  File "pygame\_numericsurfarray.pyc", line 10, in __load
  File "Numeric.pyc", line 93, in 
  File "Precision.pyc", line 26, in 
  File "Precision.pyc", line 23, in _fill_table
  File "Precision.pyc", line 18, in _get_precisions
TypeError: data type not understood


Re: [pygame] py2exe problems

2008-03-15 Thread FT
Run it at the DOS prompt or command line


New problem.
My program (which only uses pygame) doesn't run when py2exe'd.  It says 
something about not being able to find the surfarray module when the .exe is 
run, but it closes almost instantly, so I can't really tell.  I upgraded to 
pygame 1.8, if that makes a difference.
Ian



Re: [pygame] py2exe problems

2008-03-15 Thread Gary BIshop

Ian Mallett wrote:

New problem.
My program (which only uses pygame) doesn't run when py2exe'd.  It says
something about not being able to find the surfarray module when the .exe is
run, but it closes almost instantly, so I can't really tell.  I upgraded to
pygame 1.8, if that makes a difference.



Run it from the command prompt, then you'll get to see the message.

py2exe has some facilities for forcing it to include modules.
gb


Re: [pygame] py2exe problems

2008-03-15 Thread Ian Mallett
New problem.
My program (which only uses pygame) doesn't run when py2exe'd.  It says
something about not being able to find the surfarray module when the .exe is
run, but it closes almost instantly, so I can't really tell.  I upgraded to
pygame 1.8, if that makes a difference.
Ian


Re: [pygame] py2exe problems

2008-03-12 Thread Ian Mallett
On 3/7/08, Brian Fisher <[EMAIL PROTECTED]> wrote:
> Getting py2exe to work with PyOpenGL is something I am very interested
>  in, cause I haven't gotten it to work for me yet :(
>
>  So what "still doesn't work with PyOpenGL"? What have you tried so far?
>  had you tried this?
No, but I will.
> How exactly do things "not work" for you? I assume you get an exe but
>  it fails to run? If so, what's the exact error you get in the log file
>  when trying to run it?
Yes.  I get an .exe.  The program says something like: the following
modules are not available (and among these is OpenGL.GL, etc.).  Then
the .exe crashes instantly when run.


Re: [pygame] py2exe problems

2008-03-07 Thread Brian Fisher
Getting py2exe to work with PyOpenGL is something I am very interested
in, cause I haven't gotten it to work for me yet :(

So what "still doesn't work with PyOpenGL"? What have you tried so far?
had you tried this?
http://pyopengl.cvs.sourceforge.net/pyopengl/OpenGL-ctypes/src/py2exeeggs.py?view=markup


How exactly do things "not work" for you? I assume you get an exe but
it fails to run? If so, what's the exact error you get in the log file
when trying to run it?


On Fri, Mar 7, 2008 at 1:16 PM, Ian Mallett <[EMAIL PROTECTED]> wrote:
> Still doesn't work with PyOpenGL...
>


Re: [pygame] py2exe problems

2008-03-07 Thread Ian Mallett
Still doesn't work with PyOpenGL...


Re: [pygame] py2exe problems

2008-01-22 Thread FT

Hi!

Here is the skeleton file to use and the first 2 lines I use a batch
file to insert those names. Where the first one is the game to compile and
the second variable is the new name for the game and the executable file
that will be made.

My batch file just looks at what you placed on the command line for
names and attaches them to the setup.py file and then the rest is run at the
end of the batch file with the standard setup.py command line parameters
preceded by your version of python.

I guess there are many ways to change this skeleton for what usage you
want it for. commenting out that which you do not need as I have done or add
to the list what you need. It is the skeleton that is in the zip file.
Bruce


The setup.py File:
PY_PROG = 'trek10.py'
APP_NAME = 'Trek_Game'

cfg = {
'name':APP_NAME,
'version':'1.0',
'description':'',
'author':'',
'author_email':'',
'url':'',

'py2exe.target':'',
#'py2exe.icon':'icon.ico', #64x64
'py2exe.binary':APP_NAME, #leave off the .exe, it will be added

'py2app.target':'',
'py2app.icon':'icon.icns', #128x128

'cx_freeze.cmd':'~/src/cx_Freeze-3.0.3/FreezePython',
'cx_freeze.target':'',
'cx_freeze.binary':APP_NAME,
}

# usage: python setup.py command
#
# sdist - build a source dist
# py2exe - build an exe
# py2app - build an app
# cx_freeze - build a linux binary (not implemented)
#
# the goods are placed in the dist dir for you to .zip up or whatever...

from distutils.core import setup, Extension
try:
import py2exe
except:
pass

import sys
import glob
import os
import shutil

try:
cmd = sys.argv[1]
except IndexError:
print 'Usage: setup.py py2exe|py2app|cx_freeze'
raise SystemExit

# utility for adding subdirectories
def add_files( dest, generator):
for dirpath, dirnames, filenames in generator:
for name in 'CVS', '.svn':
if name in dirnames:
dirnames.remove(name)

for name in filenames:
if '~' in name: continue
suffix = os.path.splitext(name)[1]
if suffix in ('.pyc', '.pyo'): continue
if name[0] == '.': continue
filename = os.path.join(dirpath, name)
dest.append(filename)

# define what is our data
data = []
add_files( data, os.walk('data'))
data.extend( glob.glob('*.txt'))
# define what is our source
src = []
add_files( src, os.walk('lib'))
src.extend( glob.glob('*.py'))

# build the sdist target
if cmd == 'sdist':
f = open( "MANIFEST.in", "w")
for l in data: f.write("include "+l+"\n")
for l in src: f.write("include "+l+"\n")
f.close()

setup(
name=cfg['name'],
version=cfg['version'],
description=cfg['description'],
author=cfg['author'],
author_email=cfg['author_email'],
url=cfg['url'],
)

# build the py2exe target
if cmd in ('py2exe',):
dist_dir = os.path.join('dist',cfg['py2exe.target'])
data_dir = dist_dir

src = PY_PROG
dest = cfg['py2exe.binary']+'.py'
shutil.copy(src,dest)

setup(
options={'py2exe':{
'dist_dir':dist_dir,
'dll_excludes':['_dotblas.pyd','_numpy.pyd']
}},
#windows=[{
console=[{
'script':dest,
#'icon_resources':[(1,cfg['py2exe.icon'])],
}],
)

# build the py2app target
if cmd == 'py2app':
dist_dir = os.path.join('dist',cfg['py2app.target']+'.app')
data_dir = os.path.join(dist_dir,'Contents','Resources')
from setuptools import setup

src = PY_PROG
dest = cfg['py2app.target']+'.py'
shutil.copy(src,dest)

APP = [dest]
DATA_FILES = []
OPTIONS = {'argv_emulation': True, 'iconfile':cfg['py2app.icon']}

setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)

# make the cx_freeze target
if cmd == 'cx_freeze':
dist_dir = os.path.join('dist',cfg['cx_freeze.target'])
data_dir = dist_dir
os.system('%s --install-dir %s --target-name %s %s' %
(cfg['cx_freeze.cmd'], cfg['cx_freeze.binary'], dist_

Re: [pygame] py2exe problems

2008-01-22 Thread Brian Fisher
Sorry, I wasn't clear - I -have- pkg_resources, setuptools and
easyinstall, I just get that error in my py2exe'd program after trying
to do fixes for PyOpenGL in an egg - I don't get the import error in
any other context.

On Jan 22, 2008 5:26 AM, DR0ID <[EMAIL PROTECTED]> wrote:
> hi
>
> you need setuptools. pkg_resources is part of setuptools (and easyinstall).
>
> ~DR0ID
>
>
>
> Brian Fisher schrieb:
>
> > Is it python 2.5 with PyOpenGL 3.0?
> >
> > If so, I think the problem has to do with eggs. PyOpenGL 3.x is
> > distributed using them, and py2exe doesn't support them.
> >
> > I haven't actually got things working for myself yet, but thereis a
> > post by the PyOpenGL guy about it here:
> > http://blog.vrplumber.com/1762
> >
> > he has two solutions, one involving adding the egg to the path,
> > another using some fixit script here:
> > http://pyopengl.cvs.sourceforge.net/pyopengl/OpenGL-ctypes/src/py2exeeggs.py?view=markup
> >
> > ...however neither worked for me, I get an error:
> > "ImportError: No module named pkg_resources"
> >
> > hopefully you'll have more luck?
> >
> >
> > On Jan 21, 2008 5:43 PM, Ian Mallett <[EMAIL PROTECTED]> wrote:
> >
> >> Hi,
> >>
> >> I've got a great new program, which I want to make available to people
> >> without python.  I'm compiling with py2exe.  It's an OpenGL program, but
> >> py2exe says it can't find OpenGL.GL or OpenGL.GLU, the two modules I'm
> >> using.  (In addition, pygame.movieext is missing, though I'm not using
> >> that).  How can I get the OpenGL modules?  The program runs fine, so I'm 
> >> not
> >> missing OpenGL.  I installed OpenGL using easy_install.
> >>
> >> Thanks,
> >> Ian
> >>
> >>
> >
> >
>


Re: [pygame] py2exe problems

2008-01-22 Thread DR0ID

hi

you need setuptools. pkg_resources is part of setuptools (and easyinstall).

~DR0ID



Brian Fisher schrieb:

Is it python 2.5 with PyOpenGL 3.0?

If so, I think the problem has to do with eggs. PyOpenGL 3.x is
distributed using them, and py2exe doesn't support them.

I haven't actually got things working for myself yet, but thereis a
post by the PyOpenGL guy about it here:
http://blog.vrplumber.com/1762

he has two solutions, one involving adding the egg to the path,
another using some fixit script here:
http://pyopengl.cvs.sourceforge.net/pyopengl/OpenGL-ctypes/src/py2exeeggs.py?view=markup

...however neither worked for me, I get an error:
"ImportError: No module named pkg_resources"

hopefully you'll have more luck?


On Jan 21, 2008 5:43 PM, Ian Mallett <[EMAIL PROTECTED]> wrote:
  

Hi,

I've got a great new program, which I want to make available to people
without python.  I'm compiling with py2exe.  It's an OpenGL program, but
py2exe says it can't find OpenGL.GL or OpenGL.GLU, the two modules I'm
using.  (In addition, pygame.movieext is missing, though I'm not using
that).  How can I get the OpenGL modules?  The program runs fine, so I'm not
missing OpenGL.  I installed OpenGL using easy_install.

Thanks,
Ian




  


Re: [pygame] py2exe problems

2008-01-22 Thread Brian Fisher
Is it python 2.5 with PyOpenGL 3.0?

If so, I think the problem has to do with eggs. PyOpenGL 3.x is
distributed using them, and py2exe doesn't support them.

I haven't actually got things working for myself yet, but thereis a
post by the PyOpenGL guy about it here:
http://blog.vrplumber.com/1762

he has two solutions, one involving adding the egg to the path,
another using some fixit script here:
http://pyopengl.cvs.sourceforge.net/pyopengl/OpenGL-ctypes/src/py2exeeggs.py?view=markup

...however neither worked for me, I get an error:
"ImportError: No module named pkg_resources"

hopefully you'll have more luck?


On Jan 21, 2008 5:43 PM, Ian Mallett <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've got a great new program, which I want to make available to people
> without python.  I'm compiling with py2exe.  It's an OpenGL program, but
> py2exe says it can't find OpenGL.GL or OpenGL.GLU, the two modules I'm
> using.  (In addition, pygame.movieext is missing, though I'm not using
> that).  How can I get the OpenGL modules?  The program runs fine, so I'm not
> missing OpenGL.  I installed OpenGL using easy_install.
>
> Thanks,
> Ian
>


Re: [pygame] py2exe problems

2008-01-21 Thread Ian Mallett
On Jan 21, 2008 5:49 PM, René Dudfield <[EMAIL PROTECTED]> wrote:

> There is a way to tell py2exe to ignore modules.  Try using that.

python Setup.py py2exe --excludes=OpenGL
doesn't work.
What do I tell the command line?
Ian


Re: [pygame] py2exe problems

2008-01-21 Thread René Dudfield
There is a way to tell py2exe to ignore modules.  Try using that.

Also have a look in the skellington frame work for its py2exe stuff:
http://media.pyweek.org/static/skellington-11.zip

cu,




On Jan 22, 2008 12:43 PM, Ian Mallett <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've got a great new program, which I want to make available to people
> without python.  I'm compiling with py2exe.  It's an OpenGL program, but
> py2exe says it can't find OpenGL.GL or OpenGL.GLU, the two modules I'm
> using.  (In addition, pygame.movieext is missing, though I'm not using
> that).  How can I get the OpenGL modules?  The program runs fine, so I'm not
> missing OpenGL.  I installed OpenGL using easy_install.
>
> Thanks,
> Ian
>


[pygame] py2exe problems

2008-01-21 Thread Ian Mallett
Hi,

I've got a great new program, which I want to make available to people
without python.  I'm compiling with py2exe.  It's an OpenGL program, but
py2exe says it can't find OpenGL.GL or OpenGL.GLU, the two modules I'm
using.  (In addition, pygame.movieext is missing, though I'm not using
that).  How can I get the OpenGL modules?  The program runs fine, so I'm not
missing OpenGL.  I installed OpenGL using easy_install.

Thanks,
Ian


Re: [pygame] PY2EXE and Modules

2007-12-22 Thread TW


sorry, I didn't refresh my browser page before I sent that last e-mail.  Glad 
to see it worked!
Yeah, the data isn't automatically copied, that's why I specified that I had to 
copy my data over.
You can easily write a script that will copy your data over, using os 
functions, or shutil, or something.  That would be a question for the [EMAIL 
PROTECTED] mailing list.

Hi Luke,

That is OK, I also downloaded that one skeleton form from that other game 
and that is below. It was something someone else mentioned to me to do. I also 
had modified that other batch file as well.
The only modification I had made to it was to delete or comment out I mean, 
the references to the Windows command. I am using only the console for now 
because I am totally blind and the screen for Pygame is not screen reader 
friendly at the moment.

So I just added the console command instead and all works fine. Transports 
over my data file and all the sound files. The interesting error I was getting 
in the Windows command was from the raw_input command and where ever I had 
placed it. So I figured out quickly what was going on and got rid of the 
windows reference...

So now I can compile my game and have it all inside the dist folder. Now to 
have it all zipped up immediately as well. 

Also, in this file below there needs to be added the statement to not load 
all files that are not needed. I get a lot of stuff in this file that I did not 
get in the other one. In other words I get everything and probably do not need 
most of it. The dist folder ends up being 29 megs... 

Any suggestions would be helpful!

Luke, if you want to have this skeleton form here is that setup.py file I 
am using and the commented out windows and reference to the icon.ico...

Using: python25 setup.py py2exe
Setup.py File:
APP_NAME = 'Trek_Game'


cfg = {
'name':APP_NAME,
'version':'1.0',
'description':'',
'author':'',
'author_email':'',
'url':'',

'py2exe.target':'',
#'py2exe.icon':'icon.ico', #64x64
'py2exe.binary':APP_NAME, #leave off the .exe, it will be added

'py2app.target':'',
'py2app.icon':'icon.icns', #128x128

'cx_freeze.cmd':'~/src/cx_Freeze-3.0.3/FreezePython',
'cx_freeze.target':'',
'cx_freeze.binary':APP_NAME,
}

# usage: python setup.py command
#
# sdist - build a source dist
# py2exe - build an exe
# py2app - build an app
# cx_freeze - build a linux binary (not implemented)
#
# the goods are placed in the dist dir for you to .zip up or whatever...

from distutils.core import setup, Extension
try:
import py2exe
except:
pass

import sys
import glob
import os
import shutil

try:
cmd = sys.argv[1]
except IndexError:
print 'Usage: setup.py py2exe|py2app|cx_freeze'
raise SystemExit

# utility for adding subdirectories
def add_files( dest, generator):
for dirpath, dirnames, filenames in generator:
for name in 'CVS', '.svn':
if name in dirnames:
dirnames.remove(name)

for name in filenames:
if '~' in name: continue
suffix = os.path.splitext(name)[1]
if suffix in ('.pyc', '.pyo'): continue
if name[0] == '.': continue
filename = os.path.join(dirpath, name)
dest.append(filename)

# define what is our data
data = []
add_files( data, os.walk('data'))
data.extend( glob.glob('*.txt'))
# define what is our source
src = []
add_files( src, os.walk('lib'))
src.extend( glob.glob('*.py'))

# build the sdist target
if cmd == 'sdist':
f = open( "MANIFEST.in", "w")
for l in data: f.write("include "+l+"\n")
for l in src: f.write("include "+l+"\n")
f.close()

setup(
name=cfg['name'],
version=cfg['version'],
description=cfg['description'],
author=cfg['author'],
author_email=cfg['author_email'],
url=cfg['url'],
)

# build the py2exe target
if cmd in ('py2exe',):
dist_dir = os.path.join('dist',cfg['py2exe.target'])
data_dir = dist_dir

src = 'trek10.py'
dest = cfg['py2exe.binary']+'.py'
shutil.copy(src,dest)

setup(
options={'py2exe':{
'dist_dir':dist_dir,
'dll_excludes':['_dotblas.pyd','_numpy.pyd']
}},
#windows=[{
console=[{
'script':dest,
#'icon_resources':[(1,cfg['py2exe.icon'])],
}],
)

# build the py2app target
if cmd == 'py2app':
dist_dir = os.path.join('dist',cfg['py2app.target']+'.app')
data_dir = os.path.join(dist_dir,'Contents','Resources')
from setuptools import setup

src = 'trek10.py'
dest = cfg['py2app.target']+'.py'
shutil.copy(src,dest)

APP = [dest]
DATA_FILES = []
OPTIONS = {'argv_emulation': True, 'iconfile':cfg['py2app.icon']}

setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],

Re: [pygame] PY2EXE and Modules

2007-12-22 Thread Luke Paireepinart
sorry, I didnt' refresh my browser page before I sent that last e-mail.
Glad to see it worked!
Yeah, the data isn't automatically copied, that's why I specified that I had
to copy my data over.
You can easily write a script that will copy your data over, using os
functions, or shutil, or something.  That would be a question for the
[EMAIL PROTECTED] mailing list.


Re: [pygame] PY2EXE and Modules

2007-12-22 Thread Luke Paireepinart
On Dec 22, 2007 2:33 PM, TW <[EMAIL PROTECTED]> wrote:

>
> Hi Luke
>
> I do not know either. All I know is that my main .py has several
> imports which are my other modules for specific tasks. The error comes at
> the very first import statement, line 12. Could it be because I use the from
> import statement?
>
> I can show you that file below. The batch files is my way of making a
> universal for all programs I make and may just do away with it since the
> work for making the module list is the same about of time to enter it into
> the setup.py file. Who knows, I just want to learn the py2exe so I can get
> it working.
>
> I have about 9 modules to import and apparently none of them are
> coming in with the py2exe. For when running the .exe I get the error. As log
> as I ma not importing any modules I get no errors in a simple test program.
>
> Bruce
>
Can you private-message me a zip of an example, with all the modules you're
importing, and the py2exe script you're using?  I'll see if I can figure out
what's wrong.


Re: [pygame] PY2EXE and Modules

2007-12-22 Thread TW
Hi!

I will look at it. The one I got from Luke did run except it did not
import my data. So the format for that is needed but I will experiment.
I wrote a batch file below to make the executable with the original file
that Luke gave me split in 2 files with just the file name and quotes
deleted. For that example had game.py inside the script command.
So I took that out and made 2 files and created a batch file to allow me
to just enter the name fully or just the name and then run the setup.

IT ALL WORKED!

Except my audio files stored in the data folder were not imported, so I
copied that folder over to the dist folder and it ran!

So the the next thing is to see which commands does that since the
examples I have seen have used so many different formats...thus making it so
confusing.

I will check this url out and see what it has to offer. My batch file is
below

Bruce
check out skellington...

It has a skeleton of a game set up.  Including a setup file to make
executables.

I think the latest version is here:
http://media.pyweek.org/static/skellington-11.zip


@echo off
Echo Is File To Make Here?
if exist %1 goto making
if exist %1.py goto py2add
echo Error! No File!
if "%1"=="" goto end
echo %1 Invalid File Name!
goto end
:py2add
copy setup1py.txt exe2make.py
echo "%1.py" >> exe2make.py
goto fil2
:making
copy setup1py.txt exe2make.py
echo "%1" >> exe2make.py
:fil2
echo File 2
type setup2py.txt >> exe2make.py
echo Making Executable For %1
python25 exe2make.py py2exe
:end



Re: [pygame] PY2EXE and Modules

2007-12-22 Thread René Dudfield
check out skellington...

It has a skeleton of a game set up.  Including a setup file to make executables.

I think the latest version is here:
http://media.pyweek.org/static/skellington-11.zip



On Dec 23, 2007 4:14 AM, TW <[EMAIL PROTECTED]> wrote:
>
> I am now trying to make an executable and the PY2EXE has no tutorial to
> explain how to use it's commands. I have done a search and it seems there is
> none. Just a short example of one that just does the console and no imports
> of modules and such. Even the sub directory examples do not explain
> anything. I even tried using the help command and got nothing that would
> explain where and when to use the commands, including format of...
>
> Does anyone know of a tutorial or explanation of the commands and where
> they are used?
>
> Like I said, the PY2EXE.org has just one simple one that I have run and
> works. But importing modules htere is nothing...
>
> Bruce
>
>


Re: [pygame] PY2EXE and Modules

2007-12-22 Thread TW

Hi Luke

I do not know either. All I know is that my main .py has several imports 
which are my other modules for specific tasks. The error comes at the very 
first import statement, line 12. Could it be because I use the from import 
statement?

I can show you that file below. The batch files is my way of making a 
universal for all programs I make and may just do away with it since the work 
for making the module list is the same about of time to enter it into the 
setup.py file. Who knows, I just want to learn the py2exe so I can get it 
working. 

I have about 9 modules to import and apparently none of them are coming in 
with the py2exe. For when running the .exe I get the error. As log as I ma not 
importing any modules I get no errors in a simple test program.

Bruce



I think you're making it more complicated than it needs to be.
I just took the example from the pygame website, and I took out all the crap 
that failed (presumably because it was for an older version of Pygame).
Then I ran it, and out popped a Build directory with an EXE inside.
Then I copied my data directories over to the Build folder, zipped it up, and 
sent it to people, and it worked fine.
I'll attach the script.

I don't really see why you're making such a complicated batch file for this.
You could put all of this scripting stuff inside the setup.py itself, and just 
use it that way.

This is confusing and unnecessarily complicated. 
It's not necessary to import modules yourself.
Py2EXE will go through your code and determine all dependencies, and build a 
library.zip for you.

The only issue that could arise is if you're generating import strings 
dynamically at runtime and eval()ing them or something, but you probably 
shouldn't be doing that anyway. 
-Luke

Main file:

#LAST MODIFIED DECEMBER 16, 2007
#ADDED GAME LEVEL TO THE GAME AND MISSION VARIABLE!
#MODIFIED DECEMBER 15, 2007
#ADDED WEAPON IMAGE FOR WHEN DEPLETED, YELLOW ALERT FOR ENTERPRISE IN GRID!
#MODIFIED DECEMBER 9, 2007
#ADDED THE OBJECTS TO THE GALAXY GRID, GG, AND TOOK THEM OFF THE STAR TREK PARM 
LIST!
#MODIFIED DECEMBER 2, 2007
#ADDED PLAY SOUND AND TIME DELAY!
#ADDED, MOVED, ALL INPUTS TO F_INPUT4TREK!
#SET UP ALL GALAXY VALUES! INIT TREK GAME!
from F_Init4Trek10 import Galaxy, Init_Galaxy, Help4Main
from random import randint, uniform
from F_Inputs4Trek10 import Star_Trek
from F_Sound import PlaySound, Time2Wait
#GALAXY SIZE!
ROW_MAX = 8
COLUMN_MAX = 8
#SYMBOLS AND IMAGES!
ESI="<[E]>"
KSI=""
STI="*(O)*"
SBI=">)B(<"
WE0 = "WENE0"

#SET MAX VALUES FOR SHIPS, BASES, STARS, ROWS, COLUMNS, KLINGONS, STAR DATE OF 
GALAXY!
GG = Galaxy( randint(9,30), randint(3,9), randint(60, 100), ROW_MAX, 
COLUMN_MAX, 0, uniform(30, 70), 0.0,0.0,0,0,0.0,0.0,0.0,0,0,0, "COM","", 
ESI,KSI,STI,SBI,WE0, [],[],[])
GG.KL = GG.SSM-1 #KLINGONS LEFT!
GG.SDT = uniform(3000, 5000) #STARTING STARDATE!
GG.SDS = GG.SDT #START STAR DATE!
GG.SD += GG.SDT #ENDING STAR DATE!
GG.MISSION = "Star Fleet Command Says "
GG.MISSION += "Your Mission is: \n You are to capture and destroy " +str( 
GG.KL) +" Klingons in " +str(int( GG.SD-GG.SDT)) +" Star Dates! \n"
GG.MISSION += "The galaxy has " +str(GG.STM) +" Stars, and " +str(GG.BSM) +" 
Star Bases For Refueling!\n"
GG.MISSION += "It is now Star Date " +str(int( GG.SDT)) +"\n So good luck!"

GAL = {} # DICTIONARY OF GALAXY VALUES AND GRIDS!
Init_Galaxy(GAL, GG)

print "Location At Start Of The Game:"
print "%s Quadrant (%d,%d) Sector (%d,%d)" % (GG.SS[0].N, GG.SS[0].Qy, 
GG.SS[0].Qx, GG.SS[0].Sy, GG.SS[0].Sx)

print GG.MISSION
PlaySound("Trek_Theme.wav", 0, 20)
print "Please Press Enter To Start The Game!"
i=raw_input("___> ")

#PLAY THE GAME NOW!
Star_Trek(GAL, GG)

if GG.KL>0:
PlaySound ("Fail.Wav", 0, -1)
Time2Wait(4) #SECONDS BEFORE PROGRAM SHUTS IT OFF!


Re: [pygame] PY2EXE and Modules

2007-12-22 Thread Luke Paireepinart
I think you're making it more complicated than it needs to be.
I just took the example from the pygame website, and I took out all the crap
that failed (presumably because it was for an older version of Pygame).
Then I ran it, and out popped a Build directory with an EXE inside.
Then I copied my data directories over to the Build folder, zipped it up,
and sent it to people, and it worked fine.
I'll attach the script.

I don't really see why you're making such a complicated batch file for this.
You could put all of this scripting stuff inside the setup.py itself, and
just use it that way.

This is confusing and unnecessarily complicated.
It's not necessary to import modules yourself.
Py2EXE will go through your code and determine all dependencies, and build a
library.zip for you.

The only issue that could arise is if you're generating import strings
dynamically at runtime and eval()ing them or something, but you probably
shouldn't be doing that anyway.
-Luke

On Dec 22, 2007 1:39 PM, TW <[EMAIL PROTECTED]> wrote:

>
>
> Hi Laura,
>
>I just got through reading the Allan Harris spin on the issue.
>Also another short sample and both use different variable names when
> asking for directories.
>
>One shows an include statement and another a PY_DIr name. It is so
> confusing to try and figure out who is right and what is the real format.
>
>I did read enough to try something and will see what happens. The need
> for a dictionary and the path as the key, or the sub directory as the key
> then I will try that and see if it works. But that is what I built in my
> batch file...See example below, at bottom.
>At the moment I have all the modules in the same directory and tried
> listing them, but the error comes when running the .exe and the error is
> on
> the very first import. As if the setup did not include them. So, there
> comes
> the include statement which is only there on one tutorial I found.
>
>Just getting the modules imported, the data files also, is what I need.
> Also, the glob.glob( command is also mention in one place, but not in
> another...
>
>Very confusing, if just one tutorial by the person who wrote py2exe and
> pygame2exe is all that is need that explains each command in detail and
> not
> just the list from the help menu.
>Some simple and not so complex, a simple tutorial on it all!
>
>Bruce
>
>
>
> http://www.py2exe.org/index.cgi/WorkingWithVariousPackagesAndModules
>
> lists some common problems people have had with certain packages and
> modules.
>
> Laura
>
> SAMPLE BATCH FILE FOR THE EXECUTE:
> @echo off
> rem NOTE: This has -w switch deleted when running python25 py2exe FOR IT
> IS
> INVALID!
> rem Batch file to automate creation of Python executables...
> rem ...using py2exe
> echo Making Temp Files!
> rem Contents= set fileName=
> copy config\1.txt config\temp1.bat
> rem Contents= set dirName=
> copy config\2.txt config\temp2.bat
> if "%1"=="/i" goto inp4con
> if not "%1"=="/I" goto line4cmd
> :inp4con
> echo (After each input press return,
> echo  Then press ctrl Z and return again)
> echo Enter the file name whose executable you want to create:
> echo (...use relative or absolute path)
> rem BELOW IS FOR CONSOLE INPUT OF THE NAME INSTEAD OF FROM THE COMMAND
> LINE:
> copy config\1.txt + con config\temp1.bat
> echo Enter the setup name to be created:
> echo (...should be same as file name, without the extension of course!)
> copy config\2.txt + con config\temp2.bat
> goto making
> :line4cmd
> rem Inserting the file and dir name entered on command line
> echo %1.py >> config\temp1.bat
> echo %1 >> config\temp2.bat
> if "%2"=="/m" goto modules
> if not "%2"=="/M" goto making
> rem Inserting the module list from a file pre-made
> :modules
> echo Modules?
> if "%3"=="" goto making
> rem Contents= setup(includes=[
> copy 3.txt + %3 config\temp3
> echo ]) >> config\temp3
> :making
> call config\temp1.bat
> rem del config\temp1.bat
> call config\temp2.bat
> rem del config\temp2.bat
> ::Now you are exporting the echo to the file!
> echo Now making the setup file:
> echo from distutils.core import setup > config\set.py
> echo import py2exe >> config\set.py
> rem echo import pygame2exe >> config\set.py
>
> rem NOW TELL IT TO MAKE AN EXECUTABLE:
> echo setup(console=["%fileName%"]) >> config\set.py
> if not exist config\temp3 goto d4dir
> copy config\set.py + temp3 config\set.py
> rem del config\temp3
> :d4dir
> echo setup(name="%dirName%", >> config\set.py
> echo  scripts=["%fileName%"], >> config\set.py
> echo ) >> config\set.py
> python25 config\set.py py2exe
> rem del config\set.py
> echo The executable has been created in \dist\%dirName%.exe
> echo errorlevel
>
>
#make standalone, needs at least pygame-1.5.3 and py2exe-0.3.1

from distutils.core import setup
import sys, os, pygame, shutil
import py2exe

#setup the project variables here.
#i can't claim these will cover all the cases
#you need, but they seem to work for all my
#projects, just chang

Re: [pygame] PY2EXE and Modules

2007-12-22 Thread TW


Hi Laura,

I just got through reading the Allan Harris spin on the issue.
Also another short sample and both use different variable names when
asking for directories.

One shows an include statement and another a PY_DIr name. It is so
confusing to try and figure out who is right and what is the real format.

I did read enough to try something and will see what happens. The need
for a dictionary and the path as the key, or the sub directory as the key
then I will try that and see if it works. But that is what I built in my
batch file...See example below, at bottom.
At the moment I have all the modules in the same directory and tried
listing them, but the error comes when running the .exe and the error is on
the very first import. As if the setup did not include them. So, there comes
the include statement which is only there on one tutorial I found.

Just getting the modules imported, the data files also, is what I need.
Also, the glob.glob( command is also mention in one place, but not in
another...

Very confusing, if just one tutorial by the person who wrote py2exe and
pygame2exe is all that is need that explains each command in detail and not
just the list from the help menu.
Some simple and not so complex, a simple tutorial on it all!

Bruce



http://www.py2exe.org/index.cgi/WorkingWithVariousPackagesAndModules

lists some common problems people have had with certain packages and
modules.

Laura

SAMPLE BATCH FILE FOR THE EXECUTE:
@echo off
rem NOTE: This has -w switch deleted when running python25 py2exe FOR IT IS
INVALID!
rem Batch file to automate creation of Python executables...
rem ...using py2exe
echo Making Temp Files!
rem Contents= set fileName=
copy config\1.txt config\temp1.bat
rem Contents= set dirName=
copy config\2.txt config\temp2.bat
if "%1"=="/i" goto inp4con
if not "%1"=="/I" goto line4cmd
:inp4con
echo (After each input press return,
echo  Then press ctrl Z and return again)
echo Enter the file name whose executable you want to create:
echo (...use relative or absolute path)
rem BELOW IS FOR CONSOLE INPUT OF THE NAME INSTEAD OF FROM THE COMMAND LINE:
copy config\1.txt + con config\temp1.bat
echo Enter the setup name to be created:
echo (...should be same as file name, without the extension of course!)
copy config\2.txt + con config\temp2.bat
goto making
:line4cmd
rem Inserting the file and dir name entered on command line
echo %1.py >> config\temp1.bat
echo %1 >> config\temp2.bat
if "%2"=="/m" goto modules
if not "%2"=="/M" goto making
rem Inserting the module list from a file pre-made
:modules
echo Modules?
if "%3"=="" goto making
rem Contents= setup(includes=[
copy 3.txt + %3 config\temp3
echo ]) >> config\temp3
:making
call config\temp1.bat
rem del config\temp1.bat
call config\temp2.bat
rem del config\temp2.bat
::Now you are exporting the echo to the file!
echo Now making the setup file:
echo from distutils.core import setup > config\set.py
echo import py2exe >> config\set.py
rem echo import pygame2exe >> config\set.py

rem NOW TELL IT TO MAKE AN EXECUTABLE:
echo setup(console=["%fileName%"]) >> config\set.py
if not exist config\temp3 goto d4dir
copy config\set.py + temp3 config\set.py
rem del config\temp3
:d4dir
echo setup(name="%dirName%", >> config\set.py
echo  scripts=["%fileName%"], >> config\set.py
echo ) >> config\set.py
python25 config\set.py py2exe
rem del config\set.py
echo The executable has been created in \dist\%dirName%.exe
echo errorlevel



Re: [pygame] PY2EXE and Modules

2007-12-22 Thread Laura Creighton
In a message of Sat, 22 Dec 2007 09:22:06 PST, "Dave LeCompte (really)" writes:
>Bruce asked about py2exe:
>
>> Does anyone know of a tutorial or explanation of the commands and
>> where
>> they are used?
>
>I assume you've already grabbed the sample from the PyGame Wiki:
>http://www.pygame.org/wiki/WindowsExecutables_Py2Exe
>
>Are you having trouble with importing modules? Py2Exe has a pass where it
>determines dependencies, which in my experience just works.
>
>
>-Dave LeCompte

http://www.py2exe.org/index.cgi/WorkingWithVariousPackagesAndModules

lists some common problems people have had with certain packages and
modules.

Laura



Re: [pygame] PY2EXE and Modules

2007-12-22 Thread TW
Hi Dave,

The example I did download and use was the one for the console. I also
downloaded the batch version, modified it so I can run and install things
using just the batch file command line options.

I noticed when looking at the examples that it has several commands to
use for directories and such but no explanation on the format and usage.
Search everywhere and could not find one doc on PY2EXE.

My batch file I have either asks you to enter the stuff on the command
line or I import and install the stuff via a external file and all that
works, but no module directory. My batch file makes, builds the setup.py
file needed for the compile.

I can compile a simple program with external modules. That works also
but still can not load my external modules that I have made to use so the
main program does not have a long list. I just need to know how to import
the modules and data files. For I also have sound files to import along with
the modules I have made.
I am not talking about third party modules, just the one I use for my
game, like sound.py, quadrants.py, init.py...

Bruce




Bruce asked about py2exe:

> Does anyone know of a tutorial or explanation of the commands and
> where
> they are used?

I assume you've already grabbed the sample from the PyGame Wiki:
http://www.pygame.org/wiki/WindowsExecutables_Py2Exe

Are you having trouble with importing modules? Py2Exe has a pass where it
determines dependencies, which in my experience just works.


-Dave LeCompte



Re: [pygame] PY2EXE and Modules

2007-12-22 Thread Dave LeCompte (really)
Bruce asked about py2exe:

> Does anyone know of a tutorial or explanation of the commands and
> where
> they are used?

I assume you've already grabbed the sample from the PyGame Wiki:
http://www.pygame.org/wiki/WindowsExecutables_Py2Exe

Are you having trouble with importing modules? Py2Exe has a pass where it
determines dependencies, which in my experience just works.


-Dave LeCompte


[pygame] PY2EXE and Modules

2007-12-22 Thread TW

I am now trying to make an executable and the PY2EXE has no tutorial to
explain how to use it's commands. I have done a search and it seems there is
none. Just a short example of one that just does the console and no imports
of modules and such. Even the sub directory examples do not explain
anything. I even tried using the help command and got nothing that would
explain where and when to use the commands, including format of...

Does anyone know of a tutorial or explanation of the commands and where
they are used?

Like I said, the PY2EXE.org has just one simple one that I have run and
works. But importing modules htere is nothing...

Bruce



Re: [pygame] Py2EXE Error Involving raw_input

2007-10-15 Thread Kris Schnee

Patrick Mullen wrote:

On 10/13/07, [EMAIL PROTECTED] * 
<[EMAIL PROTECTED] > wrote:

In other words the raw_input command is doing something odd in EXE form,
even before the program is able to display the prompt or accept
input. Any
idea what's going on, or why this error would only appear in the
EXE? This
is a very simple program with no special modules but Pygame.


My guess is that you used py2exe with the "windows" argument, meaning 
that no console is opened - without a console there is no stdin for 
raw_input to use.  You can instead use the "console" argument in your 
setup.py, and your exe will open a console window allowing raw_input to 
work.


That was it exactly; thanks!

You can download the EXE with source and a few example images and 
"masks" at . It's not 
much to look at and even now I'm finding that rotated versions of these 
tiles don't quite match, but hopefully someone will get some use from it.


Looking at how the tiles turn out, the program has me imagining 
procedurally generating the transition tiles at run-time, so that the 
only landscape graphics are the raw terrain textures. Might be 
interesting to try.


Re: [pygame] Py2EXE Error Involving raw_input

2007-10-15 Thread Patrick Mullen
On 10/13/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I tried to build the little graphics tool I recently mentioned -- the one
> that makes "edge tiles" -- into an EXE, and got a strange error. The
> program runs fine in IDLE and when run directly by double-clicking the
> source file, but the EXE crashes with the following error (automatically
> placed in a logfile):
>
> Traceback (most recent call last):
>   File "tile_maker.py", line 98, in ?
>   File "tile_maker.py", line 90, in RunDemo
> EOFError: EOF when reading a line
>
> Where the relevant line is just this:
>
> tile1 = raw_input("Image 1 filename (BMP/PNG in same directory)?> ")
>
> In other words the raw_input command is doing something odd in EXE form,
> even before the program is able to display the prompt or accept input. Any
> idea what's going on, or why this error would only appear in the EXE? This
> is a very simple program with no special modules but Pygame.
>
>
My guess is that you used py2exe with the "windows" argument, meaning that
no console is opened - without a console there is no stdin for raw_input to
use.  You can instead use the "console" argument in your setup.py, and your
exe will open a console window allowing raw_input to work.


[pygame] Py2EXE Error Involving raw_input

2007-10-13 Thread kschnee
I tried to build the little graphics tool I recently mentioned -- the one
that makes "edge tiles" -- into an EXE, and got a strange error. The
program runs fine in IDLE and when run directly by double-clicking the
source file, but the EXE crashes with the following error (automatically
placed in a logfile):

Traceback (most recent call last):
  File "tile_maker.py", line 98, in ?
  File "tile_maker.py", line 90, in RunDemo
EOFError: EOF when reading a line

Where the relevant line is just this:

tile1 = raw_input("Image 1 filename (BMP/PNG in same directory)?> ")

In other words the raw_input command is doing something odd in EXE form,
even before the program is able to display the prompt or accept input. Any
idea what's going on, or why this error would only appear in the EXE? This
is a very simple program with no special modules but Pygame.



Re: [pygame] py2exe / OpenGL Build Trouble

2007-08-01 Thread Kris Schnee

Dave LeCompte (really) wrote:

"Kris Schnee" <[EMAIL PROTECTED]> wrote

I just built an EXE using Pygame and PyOpenGL, and the EXE crashes with
this message:



I think it depends on what version of PyOpenGL and Py2EXE you have
installed - the documentation here seems to think it's no longer a
problem:



What I ended up doing was rewriting the __version__ assignment in
__init__.py, like so:

try:
filename = os.path.join(os.path.dirname(__file__), 'version')
__version__ = string.strip(open(filename).read())
except Exception,err:
__version__ = '2.0.2.01'


Clearly a hack, but it's worked so far. You may want to verify what
version of PyOpenGL you have installed before you apply it to your own
machine...



Quick reply: I made that change to the __init__.py file, and the EXE now 
works -- so, thanks. Unfortunately I don't seem able to install the new 
version of PyOpenGL, though! The Sourceforge page offers a source ZIP 
with no Windows installer, and when I use "python setup.py" on the 
source, I get an error about -- I don't have it offhand, but some sort 
of missing module like "setuptools."


Re: [pygame] py2exe / OpenGL Build Trouble

2007-07-29 Thread Dave LeCompte (really)
"Kris Schnee" <[EMAIL PROTECTED]> wrote
> I just built an EXE using Pygame and PyOpenGL, and the EXE crashes with
> this message:
>
> Traceback (most recent call last):
>File "cubeland.py", line 13, in ?
>File "OpenGL\__init__.pyc", line 18, in ?
>File "OpenGL\__init__.pyc", line 14, in __set_attributes
> IOError: [Errno 2] No such file or directory:
> 'C:\\Python24\\dist\\library.zip\\OpenGL\\version'
>
>
> What do I do about this problem?

I think it depends on what version of PyOpenGL and Py2EXE you have
installed - the documentation here seems to think it's no longer a
problem:

http://pyopengl.sourceforge.net/documentation/py2exe.html

However, I think that at one time I tinkered with my OpenGL module to get
around this. When I looked in
python24/lib/site-packages/OpenGL/__init__.py, I saw that it was trying to
open up a version file (and, looking at your stack trace, sounds like what
you're seeing too).

What I ended up doing was rewriting the __version__ assignment in
__init__.py, like so:

try:
filename = os.path.join(os.path.dirname(__file__), 'version')
__version__ = string.strip(open(filename).read())
except Exception,err:
__version__ = '2.0.2.01'


Clearly a hack, but it's worked so far. You may want to verify what
version of PyOpenGL you have installed before you apply it to your own
machine.


It looks to me like the 3.x versions of PyOpenGL don't require this sort
of nonsense, if that's an option available to you.

-Dave LeCompte









Re: [pygame] Py2exe

2007-07-03 Thread Ian Mallett

Thanks!  That works!

On 7/3/07, Will McGugan <[EMAIL PROTECTED]> wrote:


Ian Mallett wrote:

> My program is saved as a .pyw file; opens without a console.  When I
> compiled it with py2exe, it runs with a console window.  I don't want
> one.  Any ideas?  Thanks,
> Geometrian

You put the .pyw script in the 'windows' section in the call to setup.
Something like this...

setup( windows=[{"script":"myscript.pyw"}]  ... etc

Will



Re: [pygame] Py2exe

2007-07-03 Thread Will McGugan

Ian Mallett wrote:

My program is saved as a .pyw file; opens without a console.  When I 
compiled it with py2exe, it runs with a console window.  I don't want 
one.  Any ideas?  Thanks,

Geometrian


You put the .pyw script in the 'windows' section in the call to setup. 
Something like this...


setup( windows=[{"script":"myscript.pyw"}]  ... etc

Will


Re: [pygame] Py2exe

2007-07-03 Thread Dave LeCompte (really)
"Ian Mallett" <[EMAIL PROTECTED]> wrote:
> My program is saved as a .pyw file; opens without a console.  When I
> compiled it with py2exe, it runs with a console window.  I don't want one.
> Any ideas?  Thanks,
> Geometrian
>


You probably have a line like:

setup(console=[{'script':'main.py'}])

in your setup script. Instead, you want to replace 'console' with
'windows', like so:

setup(windows=[{'script':'main.py'}])


-Dave LeCompte


[pygame] Py2exe

2007-07-03 Thread Ian Mallett

My program is saved as a .pyw file; opens without a console.  When I
compiled it with py2exe, it runs with a console window.  I don't want one.
Any ideas?  Thanks,
Geometrian


Re: [pygame] py2exe

2006-06-02 Thread Brian Fisher

I assume you mean a python and pygame game... anyways, the only way I
know to make an exe for a game on windows is to use py2exe on a
windows box that has the source to the game. So I think you'd want to
find some helpful windows person or get a windows box.

On 6/2/06, Chuang Wu <[EMAIL PROTECTED]> wrote:

Hi there,

I made a game in Ubuntu Linux, How could I export it to .exe file for
Windows?

Thanks,
CC



[pygame] py2exe

2006-06-02 Thread Chuang Wu
Hi there,I made a game in Ubuntu Linux, How could I export it to .exe file for Windows?Thanks,CC