Errors of wxpython on Linux platform

The code is below,

if (self.WINDOWS == True):
                    if os.system('copy %s %s' % (localfile, copyto))
== 0:
                        self.writelog("Copy " + file + "
successfully")
                        self.copycount = self.copycount + 1
                    else:
                        self.writelog("Can not copy " + file)
                else:
                    try:
                        os.system('cp -rvf %s %s' % (localfile,
copyto))
                        self.writelog("Copy " + file + "
successfully")
                        self.copycount = self.copycount + 1
                    except os.error:
                        self.writelog("Can not copy " + file)
            self.writelog("Test Cycle " + str(i + 1) + " completed.")
        self.writelog("All test cycles completed, total " +
str(self.testcycle) + "*" + str(self.copycount/self.testcycle) + "
files copied.")

These code is executed in a thread. After the last line code as the
above is executed, I guess the thread is ready to exit, then I got the
error:

The program 'python' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.

My program crashes.....
Anybody knows what happened? And hot to fix? It is normal on windows
platform.

Hi,

The code is below,

<snip>

These code is executed in a thread. After the last line code as the
above is executed, I guess the thread is ready to exit, then I got the
error:

The program 'python' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.

My program crashes.....
Anybody knows what happened? And hot to fix? It is normal on windows
platform.

What does your writeLog method do? If it is putting that text directly
into a widget like a textctrl or something that almost certainly your
problem. You can not update widgets directly from background threads.
(see wx.CallAfter or wx.PostEvent).

If you are not directly updating widgets from a background thread then
will need to see a small runnable sample that reproduces the issue
(MakingSampleApps - wxPyWiki).

Cody

···

On Mon, Jun 7, 2010 at 3:21 AM, 88pigs <88pigs@gmail.com> wrote:

You know, you can replace most of that by using this:
    import shutil
    shutil.copy2( localfile, copyto )
and it works on ANY platform.

···

On Jun 7, 1:21 am, 88pigs <88p...@gmail.com> wrote:

The code is below,

if (self.WINDOWS == True):
if os.system('copy %s %s' % (localfile, copyto))
== 0:
self.writelog("Copy " + file + "
successfully")
self.copycount = self.copycount + 1
else:
self.writelog("Can not copy " + file)
else:
try:
os.system('cp -rvf %s %s' % (localfile,
copyto))
self.writelog("Copy " + file + "
successfully")
self.copycount = self.copycount + 1
except os.error:
self.writelog("Can not copy " + file)
self.writelog("Test Cycle " + str(i + 1) + " completed.")

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.