I am a newbie of Python and Pyglet. I just installed Pyglet on my Linux and Window7. I run a very simple test file on my Linux, I got errors
(On linux: Python 3.5.2 Pyglet 1.2.4)
The following is the test file-tests.py:
import pyglet
window = pyglet.window.Window()
pyglet.app.run()
I got the following errors when I run it on my Linux:
Traceback (most recent call last):
File "/home/work/.local/lib/python3.5/site-packages/pyglet/init.py", line 351, in getattr return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'Window'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "test.py", line 6, in <module> window = pyglet.window.Window() File "/home/work/.local/lib/python3.5/site-packages/pyglet/init.py", line 357, in getattr import(import_name)
File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/init.py", line 1816, in <module> gl._create_shadow_window()
File "/home/work/.local/lib/python3.5/site-packages/pyglet/gl/init.py", line 205, in _create_shadow_window _shadow_window = Window(width=1, height=1, visible=False)
File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/xlib/init.py", line 163, in init super(XlibWindow, self).init(args, *kwargs)
File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/init.py", line 558, in init self._create()
File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/xlib/init.py", line 353, in _create self.set_caption(self._caption)
File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/xlib/init.py", line 513, in set_caption self._set_text_property('_NET_WM_NAME', caption)
File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/xlib/init.py", line 783, in _set_text_property raise XlibException('Could not create UTF8 text property')
pyglet.window.xlib.XlibException: Could not create UTF8 text property*
This test file works ok on my Win7
(On Window7: Python 3.6.0 Pyglet 1.2.4)
Please help if you know why. Thanks.
As we figured out from the comments above, it looked like the installation output printed some odd symbols. That and the fact that pyglet had problem loading UTF-8 context lead me to believe that there were no UTF-8 support generated in the OS.
Usually, you can uncomment
en_US.UTF-8
in/etc/locale.conf
and runlocale-gen
and that should solve the problem.