In the line
return c_void_p(objc.objc_getClass(name))
objc_getClass is expecting that name is a string that ctypes can convert to a
char *. However in Python 3, all strings are unicode so name needs to be
converted to a different format before ctypes can use it. Something like
name.encode('ascii') would work.
I've not done any testing with Python 3 so I imagine that the cocoa backend has
other issues with Python 3 besides just this.
--phillip
On Sep 14, 2012, at 12:55 PM, Noyan Tokgozoglu <[email protected]> wrote:
> I would also like to contribute. Using Python 3.2.3 on Mountain Lion with
> pyglet 1.2alpha1, I get the following error when I try to import gl from
> pyglet.gl:
>
> Traceback (most recent call last):
> File "main.py", line 3, in <module>
> from pyglet.gl import gl
> File
> "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pyglet/gl/__init__.py",
> line 220, in <module>
> from .cocoa import CocoaConfig as Config
> File
> "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pyglet/gl/cocoa.py",
> line 15, in <module>
> from pyglet.canvas.cocoa import CocoaCanvas
> File
> "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pyglet/canvas/__init__.py",
> line 90, in <module>
> from pyglet.canvas.cocoa import CocoaDisplay as Display
> File
> "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pyglet/canvas/cocoa.py",
> line 15, in <module>
> from pyglet.libs.darwin.cocoapy import *
> File
> "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pyglet/libs/darwin/__init__.py",
> line 6, in <module>
> from .cocoapy import *
> File
> "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pyglet/libs/darwin/cocoapy/__init__.py",
> line 32, in <module>
> from .runtime import objc, send_message, send_super
> File
> "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pyglet/libs/darwin/cocoapy/runtime.py",
> line 1149, in <module>
> class DeallocationObserver_Implementation(object):
> File
> "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pyglet/libs/darwin/cocoapy/runtime.py",
> line 1150, in DeallocationObserver_Implementation
> DeallocationObserver = ObjCSubclass('NSObject', 'DeallocationObserver',
> register=False)
> File
> "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pyglet/libs/darwin/cocoapy/runtime.py",
> line 1050, in __init__
> self.objc_cls = create_subclass(superclass, name)
> File
> "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pyglet/libs/darwin/cocoapy/runtime.py",
> line 603, in create_subclass
> superclass = get_class(superclass)
> File
> "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pyglet/libs/darwin/cocoapy/runtime.py",
> line 402, in get_class
> return c_void_p(objc.objc_getClass(name))
> ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
>
> On Wednesday, September 5, 2012 12:13:03 AM UTC-4, Nathan wrote:
> On Mon, Jul 30, 2012 at 10:57 AM, Tristam MacDonald
> > The fact that our Cocoa event loop ever worked at all strikes me as a bit
> > of
> > a miracle. It was always a mashup of invisible/private APIs.
> >
> > I'll see if I can do some triage on it this week.
>
> Okay, I just upgraded to Mountain Lion on my main machine today and
> discovered that this still apparently hasn't been addressed. :-(
>
> How can I help? I know next to nothing about Cocoa, other than basic syntax
> and having run through a couple tutorials, but if there's anything I can do
> to help get pyglet working on Mountain Lion sooner rather than later, please
> let me know.
>
> I would be happy to help debug or test or research or whatever.
>
> ~ Nathan
>
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pyglet-users/-/qGl1lOxmZ0gJ.
> 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.
--
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.