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

[pygame] pygame/__init__.py error on Mac OS X 10.4



Hi,

I am running pygame 1.6.2 on my OS X box here, and keep coming up with the following error whenever I try to initialize pygame:

File "/usr/local/lib/python2.4/site-packages/pygame/__init__.py", line 181, in init
os.chdir(os.path.basedir(sys.argv[0]))
AttributeError: 'module' object has no attribute 'basedir'


The relevant chunk of code from pygame/__init__.py is around line 181:

"""
if sys.platform == 'darwin':
... # other darwin specific init code
if (os.getcwd() == '/') and len(sys.argv):
os.chdir(os.path.basedir(sys.argv[0])) # This line causes an error
"""


I think the problem is that there is no basedir function in the os.path module, and it's supposed to be os.path.dirname(). I have changed my copy of __init__.py to use dirname() instead of basedir() and pygame appears to init normally afterwards.

In pygame 1.6, this line is different and doesn't cause any problem:

"""
# pygame 1.6
if sys.platform == 'darwin':
    ...
    if (os.getcwd() == '/') and len(sys.argv):
        os.chdir(os.path.split(sys.argv[0])[0])
"""

So, if anyone can shed any light on this for me, it would be much appreciated. I think it should be a straightforward fix, but I am not sure if there is something else I'm missing here.

Thanks,
Todd