[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Pygame2Exe problems



I dealt with this a couple weeks ago. Here is my setup.py:

from distutils.core import setup, Extension

import sys, os, pygame, shutil
import py2exe

sys.argv[1:] = ['py2exe'] + sys.argv[1:]

setup( options={ "py2exe": { "packages": ["standard",
                                          "standard.gameObject",
                                          "standard.message",
                                          "game"] } },
       name='Copter',
       author='my name',
       author_email='copter@mysite.com',
       url='www.mysite.com',
       version='0.1',
       packages=['standard',
                 'standard.gameObject',
                 'standard.message',
                 'game'],
       windows=['main.py'],
       data_files=[ ('resources', ['resources/heli.png',
                                   'resources/heli_layout.png']),
                    ('data', ['data/copter.xml']) ],
       zipfile = "lib/shared.zip")


#also need to hand copy the extra files here
def installfile(name):
    dst = 'dist'
    print 'copying', name, '->', dst
    if os.path.isdir(name):
        dst = os.path.join(dst, name)
        if os.path.isdir(dst):
            shutil.rmtree(dst)
        shutil.copytree(name, dst)
    elif os.path.isfile(name):
        shutil.copy(name, dst)
    else:
        print 'Warning, %s not found' % name


pygamedir = os.path.split(pygame.base.__file__)[0]
installfile(os.path.join(pygamedir, pygame.font.get_default_font()))

The only problem that I had was that the font wasn't working.

-austin


On Tue Dec  7 14:20 , andrew baker <failrate@gmail.com> sent:

>Oooh, I'll try that when I get home.  Thankee.
>
>
>On Tue, 7 Dec 2004 13:01:37 -0700, Tom Flanagan theknio@gmail.com> wrote:
>> Hi, the --console and --force arguments are depreciated in newer
>> py2exe versions.
>> 
>> they are now part of the setup() call.scroll down a bit on
>> http://starship.python.net/crew/theller/py2exe/ and it describes the
>> new usage.
>> 
>> should look something like this:
>> 
>> # setup.py
>> from distutils.core import setup
>> import py2exe
>> 
>> setup(console=["myscript.py"])
>> 
>> #
>> python setup.py py2exe
>> 
>> -Knio
>> 
>> 
>> 
>> On Tue, 7 Dec 2004 09:33:10 -0800, Zak Arntson zak.arntson@gmail.com> wrote:
>> > I'm using Python 2.3.4, Pygame 1.6 and py2exe 0.5.4
>> >
>> > When I run the pygame2exe.py script I get an error message telling me
>> > that --force is not a valid argument. So I remove that, and it turns
>> > out --console isn't valid. Anyone have the same issues? It seems like
>> > I'm not running things properly.
>> >
>> > I've set my variables to the following:
>> > script = "glob.py"              #name of starting .PY
>> > icon_file = ""                  #ICO file for the .EXE (not working well)
>> > optimize = 2                    #0, 1, or 2; like -O and -OO
>> > dos_console = 0                 #set to 0 for no dos shell when run
>> > extra_data = ['readme.txt'] #extra files/dirs copied to game
>> > extra_modules = ['pygame.locals']   #extra python modules not auto found
>> >
>> > Thanks. I have some game programming demos that I'm hoping to show,
>> > and I don't want to have to install Python and Pygame onto somebody's
>> > machine.
>> >
>> > --
>> > Zak Arntson
>> > http://www.harlekin-maus.com - Games - Lots of 'em
>> >
>> 
>
>
>-- 
>Andrew Ulysses Baker
>"failrate"