My code runs fine on Windows 7, but when porting it to Linux, I'm having the following error:
The program 'python' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadImplementation (server does not implement operation)'.
(Details: serial 71979 error_code 17 request_code 20 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
This happens when updating the icon on a button like this:
self.myButton.SetBitmapLabel(self.myImage)
where self.myButton is a wx.lib.buttons.GenBitmapButton object and self.myImage is a wx._gdi.Bitmap object.
I'm using Python 2.7, wxPython 2.8.11.0, on RHEL5u3-64.
The error message says I should run my application with --sync ... don't know how to make that work (and doubt it will be of any use). It doesn't seem me that the error occurs much before the crash like the message seems to say.
My code runs fine on Windows 7, but when porting it to Linux, I'm having
the following error:
The program 'python' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadImplementation (server does not implement operation)'.
(Details: serial 71979 error_code 17 request_code 20 minor_code 0)
Interesting. Request_code 20 is the GetProperty request. How did you
create your image/bitmap?
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
self.myImage = wx.Bitmap("image.xpm", type = wx.BITMAP_TYPE_ANY)
Could that be that using xpm files is not good ?
Raphael
···
On 2011-12-01 19:04, Tim Roberts wrote:
Raphael Mayoraz wrote:
Hello,
My code runs fine on Windows 7, but when porting it to Linux, I'm having
the following error:
The program 'python' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadImplementation (server does not implement operation)'.
(Details: serial 71979 error_code 17 request_code 20 minor_code 0)
Interesting. Request_code 20 is the GetProperty request. How did you
create your image/bitmap?
self.myImage = wx.Bitmap("image.xpm", type = wx.BITMAP_TYPE_ANY)
Could that be that using xpm files is not good ?
wx.Bitmap certainly supports XPM images. Have you printed the value of
self.myImage to make sure the creation is working? Does the behavior
change if you specify BITMAP_TYPE_XPM? Is the file actually in the
current directory when this runs?
(I admit this is just shooting in the dark. I don't have a good
explanation for how this sequence could have led to a BadImplementation
error in a GetProperty request.)
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
I think wx.Bitmap has an IsOK() method, or something like that.
-Chris
···
On 12/2/2011 10:07 AM, Tim Roberts wrote:
self.myImage = wx.Bitmap("image.xpm", type = wx.BITMAP_TYPE_ANY)
Could that be that using xpm files is not good ?
wx.Bitmap certainly supports XPM images. Have you printed the value of
self.myImage to make sure the creation is working? Does the behavior
change if you specify BITMAP_TYPE_XPM? Is the file actually in the
current directory when this runs?
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
self.myImage = wx.Bitmap("image.xpm", type = wx.BITMAP_TYPE_ANY)
Could that be that using xpm files is not good ?
wx.Bitmap certainly supports XPM images. Have you printed the value of
self.myImage to make sure the creation is working?
Check the return value of self.myImage.IsOk() too.
Does the behavior
change if you specify BITMAP_TYPE_XPM? Is the file actually in the
current directory when this runs?
And does it make any difference if you convert the .xpm to a .png and then have your program load that instead?
(I admit this is just shooting in the dark. I don't have a good
explanation for how this sequence could have led to a BadImplementation
error in a GetProperty request.)
Me neither, although SetBitmapLabel does do some image manipulation to create a greyed out version of the image, so it could be there that the problem is happening.
If all else fails please make a small runnable application that shows the problem. MakingSampleApps - wxPyWiki
Problem solved, my bad.
I tried your solutions (wx.IsOk, using png files instead of xpm, etc.) but was still getting the problem.
Finally, it turns out that my (beginner) mistake was to update the buttons using SetBitmapLabel from within a thread object. Since I separated the thread and updating the GUI, it works fine. Interestingly, this was not a problem on Windows.
Thanks for your help.
Raphael
···
On 2011-12-02 19:22, Robin Dunn wrote:
On 12/2/11 10:07 AM, Tim Roberts wrote:
Raphael Mayoraz wrote:
I'm doing:
self.myImage = wx.Bitmap("image.xpm", type = wx.BITMAP_TYPE_ANY)
Could that be that using xpm files is not good ?
wx.Bitmap certainly supports XPM images. Have you printed the value of
self.myImage to make sure the creation is working?
Check the return value of self.myImage.IsOk() too.
Does the behavior
change if you specify BITMAP_TYPE_XPM? Is the file actually in the
current directory when this runs?
And does it make any difference if you convert the .xpm to a .png and then have your program load that instead?
(I admit this is just shooting in the dark. I don't have a good
explanation for how this sequence could have led to a BadImplementation
error in a GetProperty request.)
Me neither, although SetBitmapLabel does do some image manipulation to create a greyed out version of the image, so it could be there that the problem is happening.
If all else fails please make a small runnable application that shows the problem. MakingSampleApps - wxPyWiki
Problem solved, my bad.
I tried your solutions (wx.IsOk, using png files instead of xpm, etc.)
but was still getting the problem.
Finally, it turns out that my (beginner) mistake was to update the
buttons using SetBitmapLabel from within a thread object. Since I
separated the thread and updating the GUI, it works fine.
I should have stuck with my instincts. My first thought was to ask you about threads, but usually that triggers a different type of X11 error so I thought it must be something else. Congrats on finding and solving the problem, ultimately you probably gained more by doing it yourself than if you would have gotten the right answer from us.
Interestingly,
this was not a problem on Windows.
Yep. It's not too hard to ensure that correctly written code works correctly on all the platforms, but it is impossible to ensure that incorrectly written code fails correctly or consistently (if it fails at all) on all platforms.