Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51327

Re: PyGLet, 2to3...?

Newsgroups comp.lang.python
Date 2013-07-26 18:19 -0700
References (1 earlier) <a548b0e1-4d48-4667-ae97-f356771140e6@googlegroups.com> <mailman.5103.1374763156.3114.python-list@python.org> <5c35c252-67ed-4810-88b2-6708ed321bee@googlegroups.com> <d5edc756-bcdd-4e67-a659-68aaf575a8f0@googlegroups.com> <31cf07ec-3f37-45da-84b1-06b12609319d@googlegroups.com>
Message-ID <0e68990c-1928-41f5-bfa5-cf6b4437050c@googlegroups.com> (permalink)
Subject Re: PyGLet, 2to3...?
From John Ladasky <john_ladasky@sbcglobal.net>

Show all headers | View raw


I'm making progress, but I'm not out of the woods yet.

I'm trying to run some of the programs from the tutorial web pages, and from the pyglet1.2alpha1/examples directory.  I've realized that I will probably need to run 2to3 on the many of the latter.  

The Hello, World example runs.

http://www.pyglet.org/doc/programming_guide/hello_world.html

The Image Viewer example... 

http://www.pyglet.org/doc/programming_guide/image_viewer.html

...runs if I provide a local image file, and load it using pyglet.image.load().  As written, the example fails on the line:

image = pyglet.resource.image('kitten.jpg')  

It's possible that the alpha1.2 version of PyGLet is missing some resources.

It looks like the code for the bouncing ball example ought to work, but it doesn't.  That code can be found on the web at:

http://www.pyglet.org/doc/programming_guide/noisy.py

and also in the PyGLet package, in the folder pyglet1.2alpha1/examples/noisy.  

Here's my traceback which, I am sorry to report, I find less than fully informative:

===============================

Traceback (most recent call last):
  File "/usr/local/lib/python3.3/dist-packages/pyglet/__init__.py", line 332, in __getattr__
    return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'load'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.3/dist-packages/pyglet/lib.py", line 111, in load_library
    lib = ctypes.cdll.LoadLibrary(name)
  File "/usr/lib/python3.3/ctypes/__init__.py", line 431, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python3.3/ctypes/__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libavbin.so: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "noisy.py", line 56, in <module>
    sound = pyglet.resource.media(BALL_SOUND, streaming=False)
  File "/usr/local/lib/python3.3/dist-packages/pyglet/resource.py", line 610, in media
    return media.load(path, streaming=streaming)
  File "/usr/local/lib/python3.3/dist-packages/pyglet/__init__.py", line 338, in __getattr__
    __import__(import_name)
  File "/usr/local/lib/python3.3/dist-packages/pyglet/media/__init__.py", line 1469, in <module>
    from . import avbin
  File "/usr/local/lib/python3.3/dist-packages/pyglet/media/avbin.py", line 64, in <module>
    darwin='/usr/local/lib/libavbin.dylib')
  File "/usr/local/lib/python3.3/dist-packages/pyglet/lib.py", line 118, in load_library
    if ((self.linux_not_found_error not in o.message) and
AttributeError: 'OSError' object has no attribute 'message'

===============================

I think that only the top few lines of this traceback are relevant.  Somehow a None is being passed into some function in pyglet/__init__.py, when that function expects an object with an attribute named "load".  Looking at the source, the function being called is _ModuleProxy.__getattr__().

I often find that Python's tracebacks stop one level short of what I really want to know.  The top level calling function is frequently not named.  What part of noisy.py called the code that crashed?  Is there any way to get traceback to tell you more?

Anyway, I wondered whether this might be a Python compatibility wart in noisy.py.  Thus I tried running 2to3 on noisy.py, even though my eyes told me that the code was OK.  2to3 agreed with me, reporting: "RefactoringTool: No changes to noisy.py".

I'm not sure where to go next with this.  One thing is for certain, all of this is way over the heads of my students...

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python3, GUIs, game APIs, PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-24 22:26 -0700
  Re: Python3, GUIs, game APIs, PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-24 23:56 -0700
    Re: Python3, GUIs, game APIs, PyGLet, 2to3...? Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2013-07-25 14:05 +0530
      Re: Python3, GUIs, game APIs, PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-25 15:26 -0700
        PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-25 16:49 -0700
          Re: PyGLet, 2to3...? Jerry Hill <malaclypse2@gmail.com> - 2013-07-26 09:39 -0400
          Re: PyGLet, 2to3...? Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2013-07-26 10:22 +0530
          Re: PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-26 16:35 -0700
            Re: PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-26 18:19 -0700
              Re: PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-26 21:00 -0700

csiph-web