[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Re: PyObjc dependency replaced for pygame on Mac OS X
Hi Brian,
I tested again with fix for the colordict problem, and py2app is
working for for me (rev 1925), so I can't repro the problem, but I
will see what I can figure out if you produce a minimal sample that
does repro it.
... I'd guess though that this is not caused by pygame code though.
__init__.py is the very first pygame file imported, and pygame.base
is the very first pygame file that __init__.py imports. So there's
only like a couple dozen lines of code in pygame's __init__.py that
could be causing this, and they just "import sys, os, string", do
some windows 9x-XP directX hackery, then define the "MissingModule"
class, and I don't see how those actions could mess up sys.path
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