1
votes

I'm trying to use pyglet instead of pygame, 'cause it supports several screens. this is a sample code that I run:

import pyglet

display = pyglet.canvas.get_display()
screens = display.get_screens()
window = pyglet.window.Window(fullscreen=True, screen=screens[1])

pyglet.app.run()

and I get this error:

Traceback (most recent call last): File "/home/pi/netcomShopTV/idk.py", line 5, in window = pyglet.window.Window() File "/usr/local/lib/python2.7/dist-packages/pyglet/init.py", line 359, in getattr import(import_name) File "/usr/local/lib/python2.7/dist-packages/pyglet/window/init.py", line 1890, in gl._create_shadow_window() File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/init.py", line 209, in _create_shadow_window _shadow_window = Window(width=1, height=1, visible=False) File "/usr/local/lib/python2.7/dist-packages/pyglet/window/xlib/init.py", line 171, in init super(XlibWindow, self).init(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/pyglet/window/init.py", line 642, in init self._create() File "/usr/local/lib/python2.7/dist-packages/pyglet/window/xlib/init.py", line 265, in _create self.context.set_vsync(self._vsync) # XXX ? File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/xlib.py", line 265, in set_vsync warnings.warn(e) TypeError: expected string or buffer

Pyglet Version: 1.4.8

I searched in internet, couldn't find anything to solve this problem.

2

2 Answers

2
votes

It seems this bug was introduced with this recent change. You should definitely raise it on pyglet github issue tracker.

Meanwhile, try installing the version prior to 1.4.8. (I though suspect this may just lead to crashing on failed sync as opposed to trying to warn you and then crashing :)).

0
votes

As @alecxe mentioned, it was a bug. After I opened a ticket on github, I got the solution:

This is an exception for a Raspberry Pi specific issue. It's supposed to raise a warning, and pass without crashing. If possible, could you try editing line 265 in /usr/local/lib/python2.7/dist-packages/pyglet/gl/xlib.py, and changing:

warnings.warn(e) to warnings.warn(e.message)