On Mar 8, 11:47 pm, Tristam MacDonald <[email protected]> wrote:
> On Wed, Mar 9, 2011 at 12:43 AM, Phillip Nguyen <[email protected]>wrote:
>
> > On Mar 8, 5:35 pm, Tristam MacDonald <[email protected]> wrote:
> > > It runs beautifully for me on the default system Python and pyObjC, on a
> > > fully-upgraded installation of OS 10.6.6.
>
> > > Well, beautifully apart from image loading, which appears to be
> > completely
> > > broken.
>
> > Where is the image loading failing?  Since the image decoder imports
> > the quartz module inside a try block and falls back to a (very slow)
> > default loader if it encounters an exception, you might have to edit
> > the pyglet/image/codecs/__init__.py file to get rid of the try-except
> > surrounding the import.  Or are you saying that it is importing the
> > correct module but the loaded images are not appearing correctly?
>
> I haven't had the time to dig into it, but according to the stack trace it
> looks like it might just be an incorrect pyobjc call somewhere in the codec:
>
>   File "/Users/swiftcoder/Developer/pyglet/pyglet/resource.py", line 500, in
> image
>     identity = self._cached_images[name] = self._alloc_image(name)
>   File "/Users/swiftcoder/Developer/pyglet/pyglet/resource.py", line 444, in
> _alloc_image
>     img = pyglet.image.load(name, file=file)
>   File "/Users/swiftcoder/Developer/pyglet/pyglet/image/__init__.py", line
> 186, in load
>     image = decoder.decode(file, filename)
>   File "/Users/swiftcoder/Developer/pyglet/pyglet/image/codecs/quartz.py",
> line 134, in decode
>     image = self._get_pyglet_ImageData_from_source_at_index(sourceRef, 0)
>   File "/Users/swiftcoder/Developer/pyglet/pyglet/image/codecs/quartz.py",
> line 121, in _get_pyglet_ImageData_from_source_at_index
>     CoreFoundation.CFDataGetBytes(imageData, byteRange, buffer)
> TypeError: Don't know how to convert to extract count: {_CFRange=ii}
>

I'm getting the same error with PyObjC 2.2b3 now.  I had earlier used

defaults write com.apple.versioner.python Prefer-32-Bit 1

so my system python for which PyObjC 2.2b3 is installed was starting
up in 32-bit mode.  When I set it back, the error showed up which
means it's a 64-bit problem.

However, everything works fine using 64-bit python and PyObjC 2.3.
Looking at the function metadata for CFDataGetBytes in PyObjC 2.3, I'm
guessing that maybe the second argument here should have a type of
either {_CFRange=ll} or {_CFRange=qq} instead.  The relevant code is
here:

http://www.opensource.apple.com/source/pyobjc/pyobjc-26/pyobjc/pyobjc-core/Modules/objc/libffi_support.m

But that's as far as I got.  I don't know if it's possible to change
the argument type at runtime.

--phillip

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to