Hi folks,

I'm new to pyglet.  I'm looking for a Python GUI that I can use to teach 
game programming to students.  It's 2013.  I've already gotten my students 
working with Python 3.  I refuse to complicate their education with Python 
2.  Supposedly, pyglet 1.2 alpha 1 will work on Python 3, automatically 
running 2to3 on the core package code (if not the examples) when you 
install it using Python3.  It apparently did so, silently.  Still, I have 
had trouble getting everything to work.

I'm starting with my Ubuntu Linux 13.04 system.  I'll repeat the process on 
my Windows virtual machine, once I have understood and solved the problems 
I'm having. 

Here's what I've done successfully: I downloaded and unzipped 
pyglet1.2alpha1.tar.gz. From the pyglet1.2alpha1 directory, I executed 
"sudo python3 setup.py install".  I changed back out of the pyglet1.2alpha1 
directory, to avoid importing the local package.  Then I executed 
"python3", and from the interpreter, I executed "import pyglet".  No error 
message was received.  I exited the interpreter.

Next, I tried running some of the example code that is found in the 
package.  All the code in the directory 
pyglet1.2alpha1/examples/programming_guide 
runs fine, except for events.py and animation.py.  I could see that the 
problem with events.py was the presence of Python2 print statements.  I was 
able to make it work by applying 2to3.  In contrast, here is the traceback 
from animation.py:

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.3/dist-packages/pyglet/resource.py", line 
538, in animation
    identity = self._cached_animations[name]
  File "/usr/lib/python3.3/weakref.py", line 69, in __getitem__
    o = self.data[key]()
KeyError: 'dinosaur.gif'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "animation.py", line 62, in <module>
    animation = pyglet.resource.animation('dinosaur.gif')
  File "/usr/local/lib/python3.3/dist-packages/pyglet/resource.py", line 
540, in animation
    animation = pyglet.image.load_animation(name, self.file(name))
  File "/usr/local/lib/python3.3/dist-packages/pyglet/image/__init__.py", 
line 2425, in load_animation
    raise first_exception  
  File "/usr/local/lib/python3.3/dist-packages/pyglet/image/__init__.py", 
line 2417, in load_animation
    image = decoder.decode_animation(file, filename)
  File 
"/usr/local/lib/python3.3/dist-packages/pyglet/image/codecs/gdkpixbuf2.py", 
line 121, in decode_animation
    gif_stream = gif.read(file)
  File "/usr/local/lib/python3.3/dist-packages/pyglet/image/codecs/gif.py", 
line 85, in read
    raise ImageDecodeException('Not a GIF stream')
pyglet.image.codecs.ImageDecodeException: Not a GIF stream

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

The KeyError did not look like a Python2/3 compatibility problem.   Still, 
I tried running 2to3 on animation.py.  2to3 reported back "RefactoringTool: 
No files need to be modified."  I'm stuck on this one.

Finally, I could not run pyglet1.2alpha1/tests/test/py.  This was, at least 
partially, a 2to3 problem:

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

  File "test.py", line 274
    print '-' * 78
            ^
SyntaxError: invalid syntax

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

But when I fixed the offending print statement with 2to3, I got another 
error, from inside pyglet itself:

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

Traceback (most recent call last):
  File "test.py", line 215, in <module>
    import tests.regression
  File "../tests/regression/__init__.py", line 11, in <module>
    from pyglet.image import get_buffer_manager
  File "../pyglet/__init__.py", line 276
    print '[%d] %s%s %s' % (thread, indent, name, location)
                       ^
SyntaxError: invalid syntax

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

That error message suggests that 2to3 did not, in fact, correct every 
Python2 print statement that it encountered when building and installing 
pyglet.  That worries me.  What else might 2to3 have failed to correct?

I'm not complaining, I realize that things like this are very difficult to 
automate.  But if anyone has any advice to solve the two problems I'm 
seeing, I would appreciate it.  I want to give pyglet a thorough workout 
before offering it to my students.  I would hate to see them try to use it, 
run into problems that have to do with the package and not their own code, 
and give up.  Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to