Path: csiph.com!usenet.pasdenom.info!news.albasani.net!news.imp.ch!newsfeed.tiscali.ch!news1.as3257.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'broken': 0.04; 'syntax': 0.04; 'anyway.': 0.05; 'distutils': 0.07; 'problem:': 0.07; 'skip:" 60': 0.07; 'tool,': 0.07; '2to3': 0.09; 'exception,': 0.09; 'executes': 0.09; 'extracted': 0.09; 'setup.py': 0.09; 'runs': 0.10; 'python': 0.11; 'itself.': 0.14; "%s'": 0.16; "'-'": 0.16; 'filename)': 0.16; 'fine.': 0.16; 'keyerror': 0.16; 'ported': 0.16; 'skip:" 70': 0.16; 'subject:problems': 0.16; 'syntaxerror:': 0.16; 'traceback.': 0.16; 'exception': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'looked': 0.18; 'trying': 0.19; "hasn't": 0.19; 'skip:p 40': 0.19; 'examples': 0.20; 'seems': 0.21; 'example': 0.22; 'import': 0.22; 'tests': 0.22; 'print': 0.22; 'install': 0.23; 'installation': 0.23; 'error': 0.23; 'directory.': 0.24; 'finally,': 0.24; 'issue,': 0.24; 'module,': 0.24; 'earlier': 0.24; 'mon,': 0.24; "haven't": 0.24; 'looks': 0.24; 'question': 0.24; 'script': 0.25; 'first,': 0.26; 'handling': 0.26; 'skip:" 30': 0.26; 'skip:" 20': 0.27; 'header :In-Reply-To:1': 0.27; 'tried': 0.27; 'appear': 0.29; 'skip:p 30': 0.29; 'raise': 0.29; 'reporting': 0.29; 'errors': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'getting': 0.31; "skip:' 10": 0.31; 'crash': 0.31; 'directory,': 0.31; 'invoke': 0.31; 'keyerror:': 0.31; 'produces': 0.31; 'file': 0.32; 'run': 0.32; 'another': 0.32; 'worked': 0.33; 'running': 0.33; '(most': 0.33; 'guess': 0.33; 'raw': 0.33; 'core': 0.34; 'could': 0.34; 'problem': 0.35; 'agree': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'animation': 0.36; 'error.': 0.37; 'so,': 0.37; 'two': 0.37; 'process,': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'that,': 0.38; 'recent': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'even': 0.60; 'read': 0.60; 'john': 0.61; 'first': 0.61; 'you.': 0.62; 'back': 0.62; 'offer': 0.62; 'invalid': 0.68; 'statement,': 0.68; 'jul': 0.74; 'saw': 0.77; 'discussions,': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=u7NfMyU4UqBAjLBJiSyhDryeZs9dernlXX7NK6vyF1A=; b=aEJ0G99s9UNtAbmWuVGzq3AvTgmkZZwKag5Fe4R/XJB7KXLaHFY9KZ0dccuka04VnF IM+ag3SxAFqI6SfHdX7ctbyD0J4jjA6kfWctokCMBWGPMJMxLEWw2yvxzGWyBb58hQQg CnJEhFIIByloly3QHRItuoMDnoklgPqU6CELjhUw+qQ9oHOj/oEc1SOl7RTzZ7k9OM1U M8toPoWfM4ZWh8hLGxBStYrdGhAVK2NdDzSgEoKxzXOf9SGXt7SZhkz1u3LQO4TXjryp QD8ja5JtEPKh2MpjXN8EeZk642VgNKQ12eZnnc2GiLnAPd+hkZQm72wMniYCkIHjo5oH TK2w== X-Received: by 10.68.129.138 with SMTP id nw10mr38442416pbb.158.1375141498308; Mon, 29 Jul 2013 16:44:58 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Mon, 29 Jul 2013 17:44:18 -0600 Subject: Re: Pyglet on Python3.x, problems To: Python Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 115 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1375141508 news.xs4all.nl 15967 [2001:888:2000:d::a6]:43159 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51525 On Mon, Jul 29, 2013 at 4:04 PM, John Ladasky wrote: > pyglet-1.2alpha1/examples/programming_guide/hello_world.py runs fine. > > pyglet-1.2alpha1/examples/programming_guide/image_viewer.py also runs fin= e. > > pyglet-1.2alpha1/examples/programming_guide/animation.py produces an erro= r. Here's the traceback. > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > > Traceback (most recent call last): > File "/usr/local/lib/python3.3/dist-packages/pyglet/resource.py", line = 538, in animation > identity =3D self._cached_animations[name] > File "/usr/lib/python3.3/weakref.py", line 69, in __getitem__ > o =3D 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 > animation =3D pyglet.resource.animation('dinosaur.gif') > File "/usr/local/lib/python3.3/dist-packages/pyglet/resource.py", line = 540, in animation > animation =3D 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 =3D decoder.decode_animation(file, filename) > File "/usr/local/lib/python3.3/dist-packages/pyglet/image/codecs/gdkpix= buf2.py", line 121, in decode_animation > gif_stream =3D 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 > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > > From earlier discussions, I know that distutils automatically executes 2t= o3 on the pyglet core module, when you invoke pyglet's setup.py file from P= ython 3. The setup script does not appear to run 2to3 on the code outside = of the package itself. And while I doubted that the KeyError I saw above w= as a Python 2/3 compatibility issue, I tried running 2to3 on animation.py a= nyway. 2to3 seems to agree with me, reporting back "RefactoringTool: No fi= les need to be modified." >From the error message my first guess would be that the example is broken because the 'dinosaur.gif' file is either missing or corrupt. Have you tried running the same example in Python 2? > Finally, I got errors when trying to run pyglet-1.2alpha1/tests/test.py. = At first, it looked like the fix would be easy: > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > > File "tests/test.py", line 274 > print '-' * 78 > ^ > SyntaxError: invalid syntax > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > > Clearly this was a problem for 2to3, so I ran it on test.py. It correcte= d that one print statement, and nothing else. Then I ran test.py again. T= his time I got a deeper problem: This is in the directory that you extracted the files into, not the installation directory, correct? If so, I'm not surprised that the files in that location haven't been ported by the installer. The question then would be "what's the proper way to run the tests under Python 3", which I don't know the answer to. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > > Traceback (most recent call last): > File "test.py", line 215, in > import tests.regression > File "../tests/regression/__init__.py", line 11, in > 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 > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > > This error suggests that, during the build and install process, 2to3 left= some code uncorrected in pyglet/__init__.py. This has me worried. Could = there be other code that 2to3 failed to correct? I don't want to offer my = students a tool, only to have it crash on them. The traceback is using ../pyglet, not your system installation of pyglet, so as with the above it looks like this hasn't been ported because it's the raw copy in the installation directory. If that code had not been ported in the system installation then you would not even be able to "import pyglet" without getting an error, which you clearly are able to do since you said the first two examples worked for you.