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

Pressing keys that map to non-ASCII chars crashes pyglet. #138

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Display a window.
2. Press a key that produces a non-ASCII character (you may need to set
your keyboard layout to a foreign one).
3.

Paste in the traceback or error message:

Traceback (most recent call last):
  File "win.py", line 45, in <module>
    stackless.run()
  File "win.py", line 32, in main
    w.dispatch_events()
  File
"/usr/local/lib/python2.5/site-packages/pyglet/window/xlib/__init__.py",
line 986, in dispatch_events
    event_handler(e)
  File
"/usr/local/lib/python2.5/site-packages/pyglet/window/xlib/__init__.py",
line 1087, in _event_key
    text = self._event_text(ev)
  File
"/usr/local/lib/python2.5/site-packages/pyglet/window/xlib/__init__.py",
line 1033, in _event_text
    text = unicode(buffer.value[:count])
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb4 in position 0:
ordinal not in range(128)

Paste in the output of tools/gl_info.py:

Platform instance is <pyglet.window.xlib.XlibPlatform object at 0x832930c>
Display instance is <pyglet.window.xlib.XlibDisplayDevice object at 0xb7d0c9cc>
Screens:
  XlibScreen(screen=0, x=0, y=0, width=1400, height=1050, xinerama=1)
Creating default context...
GL attributes:
double_buffer=1 stereo=False buffer_size=32 aux_buffers=0
sample_buffers=0 samples=0 red_size=8 green_size=8 blue_size=8
alpha_size=8 depth_size=24 stencil_size=0 accum_red_size=0
accum_green_size=0 accum_blue_size=0 accum_alpha_size=0
GL version: 2.0.6474 (8.38.6)
GL vendor: ATI Technologies Inc.
GL renderer: ATI Mobility Radeon X1400
GL extensions:
  GL_ARB_texture_compression GL_EXT_blend_color GL_EXT_blend_subtract
  GL_EXT_stencil_wrap GL_EXT_vertex_array
  GL_EXT_texture_compression_s3tc GL_ATI_separate_stencil
  GL_ARB_depth_texture GL_ARB_vertex_blend
  GL_ATI_texture_compression_3dc GL_EXT_texture_object
  GL_EXT_vertex_shader GL_EXT_blend_func_separate
  GL_ATI_shader_texture_lod GL_EXT_texture_cube_map
  GL_ARB_occlusion_query GL_ARB_transpose_matrix
  GL_ARB_texture_border_clamp GL_EXT_fog_coord GL_ARB_texture_cube_map
  GL_ARB_point_parameters GL_EXT_texture_env_dot3
  GL_ATI_texture_env_combine3 GL_EXT_multi_draw_arrays
  GL_HP_occlusion_test GL_ATIX_texture_env_combine3
  GL_ATIX_vertex_shader_output_point_size GL_ARB_vertex_program
  GL_ARB_texture_env_dot3 GL_EXT_bgra GL_SGIS_texture_edge_clamp
  GL_ATI_fragment_shader GL_ARB_texture_env_combine
  GL_ARB_vertex_buffer_object GL_EXT_shadow_funcs
  GL_EXT_separate_specular_color GL_EXT_texture_env_add
  GL_EXT_texture_mirror_clamp GL_SGIS_texture_border_clamp
  GL_ATI_vertex_attrib_array_object GL_ARB_point_sprite
  GL_EXT_framebuffer_object GL_ARB_vertex_shader GL_ARB_draw_buffers
  GL_ARB_fragment_program_shadow GL_ATI_element_array
  GL_SGI_color_matrix GL_ATI_texture_mirror_once GL_NV_texgen_reflection
  GL_EXT_clip_volume_hint GL_EXT_compiled_vertex_array
  GL_EXT_point_parameters GL_ARB_texture_float GL_ARB_fragment_shader
  GL_ATI_texture_float GL_ARB_fragment_program GL_ARB_shader_objects
  GL_ARB_shading_language_100 GL_ATI_vertex_streams GL_NV_blend_square
  GL_ATI_envmap_bumpmap GL_EXT_texture_env_combine
  GL_EXT_texgen_reflection GL_EXT_texture_lod_bias GL_ARB_shadow_ambient
  GL_EXT_abgr GL_ARB_texture_rectangle GL_ARB_multisample
  GL_SGIS_generate_mipmap GL_ATI_map_object_buffer
  GL_EXT_texture_filter_anisotropic GL_EXT_blend_minmax
  GL_ARB_texture_env_crossbar GL_SGIS_texture_lod
  GL_ATIX_texture_env_route GL_EXT_texture_rectangle
  GL_EXT_texture_edge_clamp GL_ARB_window_pos GL_ARB_shadow
  GL_ARB_texture_mirrored_repeat GL_SUN_multi_draw_arrays GL_S3_s3tc
  GL_EXT_texture3D GL_ARB_multitexture GL_EXT_secondary_color
  GL_EXT_draw_range_elements GL_ATI_draw_buffers
  GL_ATI_vertex_array_object GL_NV_occlusion_query
  GL_ARB_texture_env_add GL_EXT_packed_pixels GL_EXT_rescale_normal
  GL_ARB_pixel_buffer_object
GLU version: 1.3
GLU extensions:
  GLU_EXT_nurbs_tessellator GLU_EXT_object_space_tess

Context is XlibGLContext()
GLX is direct
GLX server vendor: SGI
GLX server version: 1.2
GLX server extensions:
  GLX_ARB_multisample GLX_EXT_visual_info GLX_EXT_visual_rating
  GLX_EXT_import_context GLX_EXT_texture_from_pixmap GLX_OML_swap_method
  GLX_SGI_make_current_read GLX_SGIS_multisample GLX_SGIX_hyperpipe
  GLX_SGIX_swap_barrier GLX_SGIX_fbconfig GLX_MESA_copy_sub_buffer
  GLX_ARB_get_proc_address
GLX client vendor: ATI
GLX client version: 1.3
GLX client extensions:
  GLX_EXT_visual_info GLX_EXT_visual_rating GLX_EXT_import_context
  GLX_ARB_get_proc_address GLX_SGI_video_sync GLX_ARB_multisample
  GLX_ATI_pixel_format_float GLX_ATI_render_texture
GLX extensions:
  GLX_EXT_visual_info GLX_EXT_visual_rating GLX_EXT_import_context
  GLX_ARB_get_proc_address GLX_ARB_multisample

Any additional info (platform/language/hardware) that may be relevant?

Original issue reported on code.google.com by euccas...@gmail.com on 20 Sep 2007 at 3:19

GoogleCodeExporter commented 9 years ago
I saw there is a 

# TODO lookup UTF8

a few lines above, so this is probably a known issue.  It is not a problem for 
me,
since I am doing my own custom key->char mapping, and thus I'm not using text 
events
at all.  As a quick fix, I'll just use errors='replace' locally to get rid of 
the
exception.

Original comment by euccas...@gmail.com on 20 Sep 2007 at 3:31

GoogleCodeExporter commented 9 years ago
Possibly has some relevance to issue 65.

Original comment by Alex.Hol...@gmail.com on 20 Sep 2007 at 9:38

GoogleCodeExporter commented 9 years ago
Whoops, misread the comment; has nothing to do with Windows or issue 65.

Original comment by Alex.Hol...@gmail.com on 20 Sep 2007 at 12:27

GoogleCodeExporter commented 9 years ago
Fixed in r1265.  Can you please check this, as I am only guessing that the 
returned
unicode string is correct for the keyboard layout I selected.

If the Xlib UTF8 extension is not present, non-ascii characters will be ignored
instead of crashing (though this extension should be prevalent these days; it's 
been
around for 5 years).

Is there a reason besides this issue you are using your own input method?  
i.e., is
there some functionality here pyglet is missing?

Original comment by Alex.Hol...@gmail.com on 20 Sep 2007 at 2:25