Status: New
Owner: ----
New issue 190 by
usebox...@gmail.com: Cocos tries to load SDL even when not
used, crashing if it's not available
http://code.google.com/p/los-cocos/issues/detail?id=190
Cocos 0.5.5 will crash if SDL is not installed or if the library is broken,
even if your application is not using SDL for audio.
If your app requires SDL and it's no available, the cocos should report
that and exit, but it shouldn't crash (specially if SDL is not required!).
Reproduced in Linux, OS X and Win7; ie:
xwing :: Downloads/forscience » ./forscience
Traceback (most recent call last):
File "./forscience", line 3, in <module>
from game import Game
File "/Users/joshua/Downloads/forscience/game/__init__.py", line 20, in
<module>
from cocos.director import director
File "/Users/joshua/Downloads/forscience/cocos/__init__.py", line 105, in
<module>
import_all()
File "/Users/joshua/Downloads/forscience/cocos/__init__.py", line 89, in
import_all
import actions
File "/Users/joshua/Downloads/forscience/cocos/actions/__init__.py", line
37, in <module>
from basegrid_actions import *
File "/Users/joshua/Downloads/forscience/cocos/actions/basegrid_actions.py",
line 64, in <module>
from cocos.grid import Grid3D, TiledGrid3D
File "/Users/joshua/Downloads/forscience/cocos/grid.py", line 43, in
<module>
from director import director
File "/Users/joshua/Downloads/forscience/cocos/director.py", line 127, in
<module>
import cocos, cocos.audio, cocos.custom_clocks
File "/Users/joshua/Downloads/forscience/cocos/audio/__init__.py", line
40, in <module>
import pygame.mixer
File "/Users/joshua/Downloads/forscience/cocos/audio/pygame/__init__.py",
line 73, in <module>
from cocos.audio.pygame.base import *
File "/Users/joshua/Downloads/forscience/cocos/audio/pygame/base.py",
line 28, in <module>
from cocos.audio import SDL
File "/Users/joshua/Downloads/forscience/cocos/audio/SDL/__init__.py",
line 30, in <module>
import dll as SDL_dll
File "/Users/joshua/Downloads/forscience/cocos/audio/SDL/dll.py", line
253, in <module>
_dll = SDL_DLL('SDL', 'SDL_Linked_Version', '1.2')
File "/Users/joshua/Downloads/forscience/cocos/audio/SDL/dll.py", line
58, in __init__
self._load_library_nix(version)
File "/Users/joshua/Downloads/forscience/cocos/audio/SDL/dll.py", line
98, in _load_library_nix
self._dll = getattr(cdll, library)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py",
line 423, in __getattr__
dll = self._dlltype(name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py",
line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Library/Frameworks/SDL.framework/SDL, 6): no suitable
image found. Did find:
/Library/Frameworks/SDL.framework/SDL: no matching architecture in
universal wrapper
/Library/Frameworks/SDL.framework/SDL: no matching architecture in
universal wrapper
I've attached a patch that fixes the problem by catching any OSError by
getattr and converting it to an ImportError that is properly caught by the
caller.
Could be related to: issue #140
Regards,
Juan
Attachments:
cocos-sdl-oserror.patch 639 bytes
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings