Opened 11 years ago

Closed 11 years ago

#42406 closed defect (fixed)

Importing sdl2 in python3.3 gives PYSDL2_DLL_PATH: unset

Reported by: Russell-Jones-OxPhys (Russell Jones) Owned by: jmroot (Joshua Root)
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: jyrkiwahlstedt, cooljeanius (Eric Gallager)
Port: py33-sdl2

Description

I guess I could set this manually, but shouldn't it be set by macports, e.g. in the module?

$ ipython3-3.3
Python 3.3.3 (default, Nov 25 2013, 20:12:26) 

...

In [1]: import sdl2
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-8ce3838bd765> in <module>()
----> 1 import sdl2

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/sdl2/__init__.py in <module>()
      1 """SDL2 wrapper package"""
----> 2 from .dll import get_dll_file, _bind
      3 from ctypes import c_int as _cint
      4 
      5 from .audio import *

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/sdl2/dll.py in <module>()
    105     dll = _DLL("SDL2", ["SDL2", "SDL2-2.0"], os.getenv("PYSDL2_DLL_PATH"))
    106 except RuntimeError as exc:
--> 107     raise ImportError(exc)
    108 
    109 def nullfunc(*args):

ImportError: could not find any library for SDL2 (PYSDL2_DLL_PATH: unset)

In [2]: 

libsdl2* are installed.

Russell

Change History (3)

comment:1 Changed 11 years ago by jmroot (Joshua Root)

Cc: jwa@… added; jmr@… removed
Owner: changed from macports-tickets@… to jmr@…
Status: newassigned

Hmm, yeah. import ctypes.util; ctypes.util.find_library('SDL2') returns None in python3.3 (as opposed to '/opt/local/lib/libSDL2.dylib’ in 2.7). Not sure if ctypes needs fixing (to search in ${prefix}/lib for example) or if I should just hardcode the path to the lib in the python code.

comment:2 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:3 Changed 11 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: assignedclosed

Fixed in r118683. It complains that a bunch of functions are missing at import time, but the examples seem to work fine.

I think there’s still probably a good case for having our ctypes look in ${prefix}/lib all the time.

Note: See TracTickets for help on using tickets.