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

Re: [pygame] Re: PyObjc dependency replaced for pygame on Mac OS X



My stupid test example (Main.py) is similar... just import, init, set_mode, sleep...

so it must be our py2app's, our setup scripts or python configs

my py2app is 0.3.6, what's yours?
------------------
    import py2app
    print py2app.__version__
------------------

also, this is what my py2app building script is (I make it do args and stuff cause I like to run it from the ide)
------------------
from distutils.core import setup
import os
import sys
import platform

file_dir_list = []

start_script = "Main.py"

terse_plat_string = platform.platform(aliased = True, terse = True)

if 'Darwin' in terse_plat_string:
    import py2app

    sys.argv[1:] = ["py2app"]
    setup(
        app = [start_script],
        data_files=file_dir_list,
        options=dict(py2app=dict(argv_emulation=True
                                 ))
    )
       
else:
    print 'ERROR: your platform',platform.platform(aliased = True, terse = True),'has no build configuration written'

-----------------

so does that build script repro the error for you? how do you call py2app?



On Fri, Feb 13, 2009 at 5:43 PM, Ulrich Petri <mail@xxxxxx> wrote:
Hm that might be true.
I updated to the latest 1927 build but i can still reproduce the problem even with this stupid simple example:

#--------------------------
import time

import pygame
from pygame.locals import *

pygame.init()

SCREEN = Rect(0, 0, 450, 450)
screen = pygame.display.set_mode(SCREEN.size)

time.sleep(5)
#--------------------------

This still produces the same error (base.so) when run through py2app.


# Fast forward 4 hours since writing the above


I have now stepped through the whole py2app and pygame init code (inside the generated app) and I now believe that this is a problem with either py2app or my system.

Py2app generates a "loader" module for each c extension. This loader basicly loops through sys.path until it finds one that ends in "lib-dynload". For reasons unclear to me the lib-dynload in the sys.path used is the one in my system python rather than in the lib/python2.5 dir inside the app bundle.


However by placing

sys.path.insert(0, os.path.join(base, 'lib', 'python2.5', 'lib-dynload'))

inside the py2app __boot__.py file (base is provided py py2app) I finally got both my sample and the original "problem" working.


So I'm sorry to have "barked up the wrong tree". If I find a more elegant solution to the problem i will post it here.

Bye
Ulrich