That example works flawlessly on my display, a stock x.org 6.9 server
on Linux.  Are you using some more specialized display, e.g. an X
server for Microsoft Windows?

I'm using ubuntu hardy's default xserver:

>> Xorg -version

X.Org X Server 1.4.0.90
Release Date: 5 September 2007
X Protocol Version 11, Revision 0
Build Operating System: Linux Ubuntu (xorg-server 2:1.4.1~git20080131-1ubuntu9)
Current Operating System: Linux thom 2.6.24-16-generic #1 SMP Thu Apr 10 13:23:42 UTC 2008 i686
Build Date: 15 April 2008  05:26:17PM
 
    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
Module Loader present



>> apt-cache show xserver-xorg | grep Version


Version: 1:7.3+10ubuntu10


>> python -V


Python 2.5.2



>> apt-cache show python-xlib | grep Version

Version: 0.14-1
Python-Version: 2.4, 2.3, 2.5


Moreover, I tried again the example again, this time using different window managers and I found that the only one that did not make python-xlib to complain was metacity (apart from running the example with no window manager at all).


any idea of what's going on?,
anyway,


Thank you for your help,
Israel





On Tue, May 27, 2008 at 2:47 PM, Peter Liljenberg <peter.liljenberg@gmail.com> wrote:
That example works flawlessly on my display, a stock x.org 6.9 server
on Linux.  Are you using some more specialized display, e.g. an X
server for Microsoft Windows?

The only event masks which should be able to result in BadAccess are
SubStructureRedirectMask and ResizeRedirectMask, as only a single X
client can set those on a given window.  This is used to grant the
window manager exclusive control over all other windows.

/Peter

On Tue, May 27, 2008 at 8:16 PM, Rene Garcia <israelgarcialara@gmail.com> wrote:
> Hi everyone,
>
> I'm new to xlib and found the following error:
>
> X protocol error:
> <class 'Xlib.error.BadAccess'>: code = 10, resource_id = 94, sequence_number
> = 7, major_opcode = 2, minor_opcode = 0
>
> It occurred within the next block of code:
>
>
> -------------------------------------------------------------------------------------------------------
> from Xlib import X, display
>
> dpy = display.Display()
> root = dpy.screen().root
> root.change_attributes(event_mask = X.ButtonPressMask)
>
> while 1:
>     event = dpy.next_event()
>     if event.type == X.ButtonPress:
>         print 'button pressed'
> --------------------------------------------------------------------------------------------------------
>
>
> It doesn't occur if I replace X.ButtonPessMask and X.ButtonPress by
> X.ButtonReleaseMask and X.ButtonRelease
>
> I wonder whether it's a bug in python-xlibs or something I don't know about
> the X protocol,
>
> thanks in advance,
>
> Israel
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> python-xlib-users mailing list
> python-xlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/python-xlib-users
>
>