google-code-export / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Most pyglet programs seem not to work for me, example: 'Hello World' (Pyglet 1.1) #330

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. 'Hello World' Example does not work. (copyed and pasted
http://pyglet.org/doc/programming_guide/hello_world.py)
2. Leaves a white window that can't be closed.
3. Most other Examples I tried lead to the same issue.

Paste in the traceback or error message:

Traceback (most recent call last):
  File "C:\Dokumente und Einstellungen\Juergen
Parnitz\Desktop\pyglet_zeug\hello_wold.py", line 49, in <module>
    anchor_x='center', anchor_y='center')
  File "C:\Python25\lib\site-packages\pyglet\text\__init__.py", line 433,
in __init__
    multiline, dpi, batch, group)
  File "C:\Python25\lib\site-packages\pyglet\text\__init__.py", line 257,
in __init__
    dpi=dpi, batch=batch, group=group)
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 768, in
__init__
    self.document = document
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 842, in
_set_document
    self._init_document()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 942, in
_init_document
    self._update()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 879, in
_update
    lines = self._get_lines()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 855, in
_get_lines
    glyphs = self._get_glyphs()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 974, in
_get_glyphs
    self._document.get_font_runs(dpi=self._dpi),
  File "C:\Python25\lib\site-packages\pyglet\text\document.py", line 603,
in get_font_runs
    ft = self.get_font(dpi=dpi)
  File "C:\Python25\lib\site-packages\pyglet\text\document.py", line 613,
in get_font
    bold=bool(bold), italic=bool(italic), dpi=dpi)
  File "C:\Python25\Lib\site-packages\pyglet\font\__init__.py", line 638,
in load
    font = _font_class(name, size, bold=bold, italic=italic, dpi=dpi)
  File "C:\Python25\Lib\site-packages\pyglet\font\win32.py", line 541, in
__init__
    None, ctypes.byref(family))
WindowsError: exception: access violation reading 0x000A0006
>>> 

Any additional info (platform/language/hardware) that may be relevant?
WindowsXp 32bit, Python 2.5.2, Pyglet1.1

I am new to programming. I just tried this out, if it's my fault it doesn't
work, I am sorry.

Original issue reported on code.google.com by JParn...@googlemail.com on 16 Aug 2008 at 7:23

GoogleCodeExporter commented 9 years ago
Hi, that's an unusual error.  I assume you can run the examples that do not 
render text (for example, opengl.py)?  
Please post the output of running (e.g., from cygwin or a command line) "python 
-m pyglet.info", which will give 
me some more information about your system.  If you're running the examples 
from IDLE or another IDE, it is 
worth trying just from the command line (or from explorer).

Original comment by Alex.Hol...@gmail.com on 24 Aug 2008 at 1:24

GoogleCodeExporter commented 9 years ago
Yes, I can run "opengl.py" from the pyglet 1.1-docs examples. I think you are 
right,
it must have something to do with text rendering.

OK, here is the output:

Python
------------------------------------------------------------------------------
sys.version: 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel
)]
sys.platform: win32
os.getcwd(): C:\Dokumente und Einstellungen\Juergen Parnitz

pyglet
------------------------------------------------------------------------------
pyglet.version: 1.1
pyglet.__file__: c:\python25\lib\site-packages\pyglet-1.1-py2.5.egg\pyglet\__ini
t__.pyo
pyglet.options['debug_trace_depth'] = 1
pyglet.options['audio'] = ('directsound', 'openal', 'alsa', 'silent')
pyglet.options['xsync'] = True
pyglet.options['debug_trace_flush'] = True
pyglet.options['debug_win32'] = False
pyglet.options['debug_gl_trace'] = False
pyglet.options['debug_x11'] = False
pyglet.options['shadow_window'] = True
pyglet.options['debug_font'] = False
pyglet.options['debug_media'] = False
pyglet.options['debug_trace'] = False
pyglet.options['debug_lib'] = False
pyglet.options['graphics_vbo'] = True
pyglet.options['vsync'] = None
pyglet.options['debug_trace_args'] = False
pyglet.options['debug_gl'] = True
pyglet.options['debug_graphics_batch'] = False
pyglet.options['font'] = ('gdiplus', 'win32')
pyglet.options['debug_texture'] = False
pyglet.options['debug_gl_trace_args'] = False

pyglet.window
------------------------------------------------------------------------------
platform: <pyglet.window.win32.Win32Platform object at 0x00D2E730>
display: <pyglet.window.win32.Win32Display object at 0x00D2E710>
screens[0]: Win32Screen(x=0, y=0, width=1280, height=1024)
config['double_buffer'] = True
config['stereo'] = False
config['buffer_size'] = 32
config['aux_buffers'] = 4
config['sample_buffers'] = 0
config['samples'] = 0
config['red_size'] = 8
config['green_size'] = 8
config['blue_size'] = 8
config['alpha_size'] = 0
config['depth_size'] = 24
config['stencil_size'] = 0
config['accum_red_size'] = 16
config['accum_green_size'] = 16
config['accum_blue_size'] = 16
config['accum_alpha_size'] = 16
context: Win32Context()

pyglet.gl.gl_info
------------------------------------------------------------------------------
gl_info.get_version(): 2.1.2
gl_info.get_vendor(): NVIDIA Corporation
gl_info.get_renderer(): GeForce 7900 GS/AGP/SSE2
gl_info.get_extensions():
   GL_ARB_color_buffer_float
   GL_ARB_depth_texture
   GL_ARB_draw_buffers
   GL_ARB_fragment_program
   GL_ARB_fragment_program_shadow
   GL_ARB_fragment_shader
   GL_ARB_half_float_pixel
   GL_ARB_imaging
   GL_ARB_multisample
   GL_ARB_multitexture
   GL_ARB_occlusion_query
   GL_ARB_pixel_buffer_object
   GL_ARB_point_parameters
   GL_ARB_point_sprite
   GL_ARB_shader_objects
   GL_ARB_shading_language_100
   GL_ARB_shadow
   GL_ARB_texture_border_clamp
   GL_ARB_texture_compression
   GL_ARB_texture_cube_map
   GL_ARB_texture_env_add
   GL_ARB_texture_env_combine
   GL_ARB_texture_env_dot3
   GL_ARB_texture_float
   GL_ARB_texture_mirrored_repeat
   GL_ARB_texture_non_power_of_two
   GL_ARB_texture_rectangle
   GL_ARB_transpose_matrix
   GL_ARB_vertex_buffer_object
   GL_ARB_vertex_program
   GL_ARB_vertex_shader
   GL_ARB_window_pos
   GL_ATI_draw_buffers
   GL_ATI_texture_float
   GL_ATI_texture_mirror_once
   GL_EXT_Cg_shader
   GL_EXT_abgr
   GL_EXT_bgra
   GL_EXT_blend_color
   GL_EXT_blend_equation_separate
   GL_EXT_blend_func_separate
   GL_EXT_blend_minmax
   GL_EXT_blend_subtract
   GL_EXT_compiled_vertex_array
   GL_EXT_depth_bounds_test
   GL_EXT_draw_range_elements
   GL_EXT_fog_coord
   GL_EXT_framebuffer_blit
   GL_EXT_framebuffer_multisample
   GL_EXT_framebuffer_object
   GL_EXT_gpu_program_parameters
   GL_EXT_multi_draw_arrays
   GL_EXT_packed_depth_stencil
   GL_EXT_packed_pixels
   GL_EXT_pixel_buffer_object
   GL_EXT_point_parameters
   GL_EXT_rescale_normal
   GL_EXT_secondary_color
   GL_EXT_separate_specular_color
   GL_EXT_shadow_funcs
   GL_EXT_stencil_two_side
   GL_EXT_stencil_wrap
   GL_EXT_texture3D
   GL_EXT_texture_compression_s3tc
   GL_EXT_texture_cube_map
   GL_EXT_texture_edge_clamp
   GL_EXT_texture_env_add
   GL_EXT_texture_env_combine
   GL_EXT_texture_env_dot3
   GL_EXT_texture_filter_anisotropic
   GL_EXT_texture_lod
   GL_EXT_texture_lod_bias
   GL_EXT_texture_mirror_clamp
   GL_EXT_texture_object
   GL_EXT_texture_sRGB
   GL_EXT_timer_query
   GL_EXT_vertex_array
   GL_IBM_rasterpos_clip
   GL_IBM_texture_mirrored_repeat
   GL_KTX_buffer_region
   GL_NVX_conditional_render
   GL_NV_blend_square
   GL_NV_copy_depth_to_color
   GL_NV_depth_clamp
   GL_NV_fence
   GL_NV_float_buffer
   GL_NV_fog_distance
   GL_NV_fragment_program
   GL_NV_fragment_program2
   GL_NV_fragment_program_option
   GL_NV_framebuffer_multisample_coverage
   GL_NV_half_float
   GL_NV_light_max_exponent
   GL_NV_multisample_filter_hint
   GL_NV_occlusion_query
   GL_NV_packed_depth_stencil
   GL_NV_pixel_data_range
   GL_NV_point_sprite
   GL_NV_primitive_restart
   GL_NV_register_combiners
   GL_NV_register_combiners2
   GL_NV_texgen_reflection
   GL_NV_texture_compression_vtc
   GL_NV_texture_env_combine4
   GL_NV_texture_expand_normal
   GL_NV_texture_rectangle
   GL_NV_texture_shader
   GL_NV_texture_shader2
   GL_NV_texture_shader3
   GL_NV_vertex_array_range
   GL_NV_vertex_array_range2
   GL_NV_vertex_program
   GL_NV_vertex_program1_1
   GL_NV_vertex_program2
   GL_NV_vertex_program2_option
   GL_NV_vertex_program3
   GL_S3_s3tc
   GL_SGIS_generate_mipmap
   GL_SGIS_texture_lod
   GL_SGIX_depth_texture
   GL_SGIX_shadow
   GL_SUN_slice_accum
   GL_WIN_swap_hint
   WGL_EXT_swap_control

pyglet.gl.glu_info
------------------------------------------------------------------------------
glu_info.get_version(): 1.2.2.0 Microsoft Corporation
glu_info.get_extensions():
   GL_EXT_bgra

pyglet.gl.glx_info
------------------------------------------------------------------------------
GLX not available.

pyglet.media
------------------------------------------------------------------------------
driver: pyglet.media.drivers.directsound

pyglet.media.avbin
------------------------------------------------------------------------------
Library: <CDLL 'avbin', handle 6e440000 at e4f6b0>
AVbin version: 5
FFmpeg revision: 13661

pyglet.media.drivers.openal
------------------------------------------------------------------------------
OpenAL not available.

I hope this will help you. Rock on!

Original comment by JParn...@googlemail.com on 27 Aug 2008 at 5:32

GoogleCodeExporter commented 9 years ago
I don't know if this will help you in any way, but I just noticed that you 
released
pyglet 1.1.1 and tried it, but I have still the same Problem.

Original comment by JParn...@googlemail.com on 27 Aug 2008 at 5:51

GoogleCodeExporter commented 9 years ago
Thanks, could you try adding the following line near the top of your test 
program?

import pyglet.image.codecs.gdiplus

Let me know if this fixes the problem so I can add a proper fix.

Original comment by Alex.Hol...@gmail.com on 28 Aug 2008 at 9:52

GoogleCodeExporter commented 9 years ago
I'm sorry, I tried it but it is still the same.

Traceback (most recent call last):
  File "C:/Dokumente und Einstellungen/Juergen
Parnitz/Desktop/pyglet_zeug/hello_wold_newtry.py", line 54, in <module>
    anchor_x='center', anchor_y='center')
  File "C:\Python25\lib\site-packages\pyglet\text\__init__.py", line 433, in __init__
    multiline, dpi, batch, group)
  File "C:\Python25\lib\site-packages\pyglet\text\__init__.py", line 257, in __init__
    dpi=dpi, batch=batch, group=group)
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 779, in __init__
    self.document = document
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 856, in _set_document
    self._init_document()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 956, in _init_document
    self._update()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 893, in _update
    lines = self._get_lines()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 869, in _get_lines
    glyphs = self._get_glyphs()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 988, in _get_glyphs
    self._document.get_font_runs(dpi=self._dpi),
  File "C:\Python25\lib\site-packages\pyglet\text\document.py", line 603, in
get_font_runs
    ft = self.get_font(dpi=dpi)
  File "C:\Python25\lib\site-packages\pyglet\text\document.py", line 613, in get_font
    bold=bool(bold), italic=bool(italic), dpi=dpi)
  File "C:\Python25\Lib\site-packages\pyglet\font\__init__.py", line 638, in load
    font = _font_class(name, size, bold=bold, italic=italic, dpi=dpi)
  File "C:\Python25\Lib\site-packages\pyglet\font\win32.py", line 541, in __init__
    None, ctypes.byref(family))
WindowsError: exception: access violation reading 0x000A000A
>>> 

Original comment by JParn...@googlemail.com on 28 Aug 2008 at 11:03

GoogleCodeExporter commented 9 years ago
It should work if you avoid GDI+.  Add the following line before any other 
imports:

import pyglet
pyglet.options['font'] = 'win32'

This uses a different font rendering engine in Windows (which should at least 
be legible, if not pretty).  Please 
confirm that you have XP service pack 2 and subsequent updates installed.

Original comment by Alex.Hol...@gmail.com on 28 Aug 2008 at 1:12

GoogleCodeExporter commented 9 years ago
Yes, service pack 2 and updates are installed.

Tried it, but still...

Traceback (most recent call last):
  File "C:\Dokumente und Einstellungen\Juergen
Parnitz\Desktop\pyglet_zeug\hello_wold_newtry.py", line 57, in <module>
    anchor_x='center', anchor_y='center')
  File "C:\Python25\lib\site-packages\pyglet\text\__init__.py", line 433, in __init__
    multiline, dpi, batch, group)
  File "C:\Python25\lib\site-packages\pyglet\text\__init__.py", line 257, in __init__
    dpi=dpi, batch=batch, group=group)
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 779, in __init__
    self.document = document
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 856, in _set_document
    self._init_document()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 956, in _init_document
    self._update()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 893, in _update
    lines = self._get_lines()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 869, in _get_lines
    glyphs = self._get_glyphs()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 988, in _get_glyphs
    self._document.get_font_runs(dpi=self._dpi),
  File "C:\Python25\lib\site-packages\pyglet\text\document.py", line 603, in
get_font_runs
    ft = self.get_font(dpi=dpi)
  File "C:\Python25\lib\site-packages\pyglet\text\document.py", line 612, in get_font
    return font.load(font_name, font_size,
  File "C:\Python25\Lib\site-packages\pyglet\__init__.py", line 307, in __getattr__
    __import__(import_name)
  File "C:\Python25\Lib\site-packages\pyglet\font\__init__.py", line 577, in <module>
    assert False, 'Unknown font driver'
AssertionError: Unknown font driver
>>> 

Original comment by JParn...@googlemail.com on 28 Aug 2008 at 1:48

GoogleCodeExporter commented 9 years ago
Sorry, that should've been

import pyglet
pyglet.options['font'] = ('win32',)

Original comment by Alex.Hol...@gmail.com on 28 Aug 2008 at 1:57

GoogleCodeExporter commented 9 years ago
Now I get this:

Traceback (most recent call last):
  File "C:\Dokumente und Einstellungen\Juergen
Parnitz\Desktop\pyglet_zeug\hello_wold_newtry.py", line 59, in <module>
    anchor_x='center', anchor_y='center')
  File "C:\Python25\lib\site-packages\pyglet\text\__init__.py", line 433, in __init__
    multiline, dpi, batch, group)
  File "C:\Python25\lib\site-packages\pyglet\text\__init__.py", line 257, in __init__
    dpi=dpi, batch=batch, group=group)
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 779, in __init__
    self.document = document
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 856, in _set_document
    self._init_document()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 956, in _init_document
    self._update()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 893, in _update
    lines = self._get_lines()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 869, in _get_lines
    glyphs = self._get_glyphs()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 988, in _get_glyphs
    self._document.get_font_runs(dpi=self._dpi),
  File "C:\Python25\lib\site-packages\pyglet\text\document.py", line 603, in
get_font_runs
    ft = self.get_font(dpi=dpi)
  File "C:\Python25\lib\site-packages\pyglet\text\document.py", line 613, in get_font
    bold=bool(bold), italic=bool(italic), dpi=dpi)
  File "C:\Python25\Lib\site-packages\pyglet\font\__init__.py", line 638, in load
    font = _font_class(name, size, bold=bold, italic=italic, dpi=dpi)
  File "C:\Python25\Lib\site-packages\pyglet\font\win32.py", line 327, in __init__
    self.logfont = self.get_logfont(name, size, bold, italic, dpi)
  File "C:\Python25\Lib\site-packages\pyglet\font\win32.py", line 355, in get_logfont
    logfont.lfFaceName = name
TypeError: expected string or Unicode object, NoneType found
>>> 

Original comment by JParn...@googlemail.com on 28 Aug 2008 at 3:11

GoogleCodeExporter commented 9 years ago
Hrm, the non-GDI+ font rendering code is deprecated, which is why you can 
expect to see a few errors like this.  
For now, just explicitly pass in a font name (e.g., 'Arial').

Original comment by Alex.Hol...@gmail.com on 28 Aug 2008 at 11:39

GoogleCodeExporter commented 9 years ago
This is a long shot, but you might also want to try (without the PYGLET_FONT 
environment variable set) changing 
pyglet/font/win32.py line 531 from

        name = ctypes.c_wchar_p(name)

to 

        name = ctypes.create_unicode_buffer(name)

Original comment by Alex.Hol...@gmail.com on 28 Aug 2008 at 11:49

GoogleCodeExporter commented 9 years ago
OK, I want to make sure I do everything right.
I changed the line in win32.py, ok.

But what is the PYGLET_FONT environment varaible?

This is the program I run:

__docformat__ = 'restructuredtext'
__version__ = '$Id: hello_world.py 2090 2008-05-29 12:49:25Z Alex.Holkner $'

import pyglet
pyglet.options['font'] = ('win32',)

import pyglet.image.codecs.gdiplus

window = pyglet.window.Window()
label = pyglet.text.Label('Hello, world', 
                          font_name='Arial', 
                          font_size=36,
                          x=window.width//2, y=window.height//2,
                          anchor_x='center', anchor_y='center')

@window.event
def on_draw():
    window.clear()
    label.draw()

pyglet.app.run()

Original comment by JParn...@googlemail.com on 29 Aug 2008 at 4:32

GoogleCodeExporter commented 9 years ago
Right, just delete the line 

pyglet.options['font'] = ('win32',)

which disables GDI+ rendering (and wouldn't really solve the issue anyway).

Original comment by Alex.Hol...@gmail.com on 29 Aug 2008 at 11:14

GoogleCodeExporter commented 9 years ago
Now I get this again:

Traceback (most recent call last):
  File "C:\Dokumente und Einstellungen\Juergen
Parnitz\Desktop\pyglet_zeug\hello_wold_newtry.py", line 58, in <module>
    anchor_x='center', anchor_y='center')
  File "C:\Python25\lib\site-packages\pyglet\text\__init__.py", line 433, in __init__
    multiline, dpi, batch, group)
  File "C:\Python25\lib\site-packages\pyglet\text\__init__.py", line 257, in __init__
    dpi=dpi, batch=batch, group=group)
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 779, in __init__
    self.document = document
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 856, in _set_document
    self._init_document()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 956, in _init_document
    self._update()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 893, in _update
    lines = self._get_lines()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 869, in _get_lines
    glyphs = self._get_glyphs()
  File "C:\Python25\lib\site-packages\pyglet\text\layout.py", line 988, in _get_glyphs
    self._document.get_font_runs(dpi=self._dpi),
  File "C:\Python25\lib\site-packages\pyglet\text\document.py", line 603, in
get_font_runs
    ft = self.get_font(dpi=dpi)
  File "C:\Python25\lib\site-packages\pyglet\text\document.py", line 613, in get_font
    bold=bool(bold), italic=bool(italic), dpi=dpi)
  File "C:\Python25\Lib\site-packages\pyglet\font\__init__.py", line 638, in load
    font = _font_class(name, size, bold=bold, italic=italic, dpi=dpi)
  File "C:\Python25\lib\site-packages\pyglet\font\win32.py", line 542, in __init__
    None, ctypes.byref(family))
WindowsError: exception: access violation reading 0x000A0006
>>> 

Original comment by JParn...@googlemail.com on 30 Aug 2008 at 9:34

GoogleCodeExporter commented 9 years ago
Out of ideas, sorry.  Let me know if you get some more information.

Original comment by Alex.Hol...@gmail.com on 30 Aug 2008 at 10:05

GoogleCodeExporter commented 9 years ago
Too bad. Thank you anyway!

Let me know, if you have some more ideas.

Original comment by JParn...@googlemail.com on 30 Aug 2008 at 12:50

GoogleCodeExporter commented 9 years ago
I realize that "me too" posts are inappropriate, however I am having an almost 
identical issue as this person, and I cannot help but notice that we are both 
using 
non-English versions of Windows. This has caused issues for me in the past, and 
I 
wonder if perhaps that is the case here as well.

Original comment by nightchr...@gmail.com on 2 Mar 2009 at 3:50

GoogleCodeExporter commented 9 years ago
Is that still actual for 1.1.4?

Original comment by techtonik@gmail.com on 18 Jul 2012 at 8:51

GoogleCodeExporter commented 9 years ago
Can you please download latest version from the repository?

http://pyglet.googlecode.com/archive/tip.zip

Just to see if this makes any difference. Thanks!

Original comment by useboxnet on 6 Oct 2013 at 8:13

GoogleCodeExporter commented 9 years ago

Original comment by useboxnet on 3 Jan 2014 at 8:24