473,320 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Can't Delete a Thread

I have the following two threads, called from a method:

def uploading_region:
uploading_region =
AddRegionToServerThread(self,self.SESSION,create_r egion)
while uploading_region.UPLOADING:
pass
#escape method when uploading_region thread is false

class AddRegionToServerThread(Thread):
def __init__(self, window, session, dict):
Thread.__init__(self)
self.SESSION = session
self.DICT = dict #contains dbuser,password, etc
self.STATUS = 'Uploading the region. Please wait...'
self.WINDOW = window
self.dlg = wx.ProgressDialog('Please Wait...', self.STATUS,
100, self.WINDOW, wx.PD_AUTO_HIDE | wx.PD_APP_MODAL)
self.RETICULATE = ReticulateSplines(self.dlg)
self.UPLOADING = True
self.start()

def run(self):
self.STATUS = 'Adding cities to database. Almost done...'
#create database
....
self.RETICULATE._Thread__delete()
time.sleep(3) #give some extra time
self.UPLOADING = False

class ReticulateSplines(Thread):
def __init__(self,dialog):
Thread.__init__(self)
self.random_messages=[
'reticulating splines','hiring code monkeys','are you still
watching this?',
'a penny saved is a penny earned','use this as an
opportunity to go outside',
'mmm water','drinking decaff coffee','neutering excess
bits',
'starting improbability drive','delousing edmontonians']
self.dialog = dialog
self.x=1
self.start()

def run(self):
self.x += 2

self.dialog.Update(self.x,self.random_messages[random.randrange(len(self.random_messages))])
time.sleep(3)
self.__init__(self.dialog)


Now for some reason, I can't delete the thread 'ReticulateSplines' in
the run() function of AddRegionToServerThread(). I call it, but the
dialog window doesn't actually close, while, for some reason I am able
to terminate AddRegionToServerThread.

Any ideas on why? I've tried a combination of things and yet nothing
works.

Any help would be greatly appreciated.

-Thanks
Flamesrock

Apr 6 '06 #1
0 937

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

32
by: Christopher Benson-Manica | last post by:
Is the following code legal, moral, and advisable? #include <iostream> class A { private: int a; public: A() : a(42) {}
12
by: Arno R | last post by:
Hi there, I just distributed an application in which I (try to) change db.properties depending on CurrentUser() For instance I set the property's AllowBypassKey and AllowBuiltinToolbars to False...
12
by: Lucas Tam | last post by:
I have a very simple loop: If (Directory.Exists(tempDirectory)) Then Try Dim Files() As String = Directory.GetFiles(tempDirectory) 'Clear out directory For Each Filename As String In Files...
4
by: Stanislaw Tristan | last post by:
CREATE RULE "new_rule2" AS ON DELETE TO "public"."klients_view" DO INSTEAD ( DELETE FROM klients WHERE (klients.klient_id = old.klient_id); DELETE FROM klient_services WHERE...
12
by: dennist685 | last post by:
Can't edit, delete or add row in an Access database in a website 2003 When I implement a walkthrough using Northwind I have no trouble doing this. Also, in a windowsforms project I have no...
5
by: Sam777 | last post by:
I was under the impression that creating the app_offline.htm file at the root of the webapp would cause all handles to be closed so that the app could be removed. Unfortunately, this isn't the...
5
by: morz | last post by:
classA { public: thirdPartyThreadLibrary myThread; void Run() { myThread.exec(); // created new thread and run on background. }
5
by: Angus | last post by:
Hello I am doing this in a worker thread: char* szPartial = new char; if (szPartial) { lstrcpy(szPartial, szBuffer); PostMessage(m_thishWnd, WM_USER+1, 0, (LPARAM)szPartial); }
12
by: better_cs_now | last post by:
Hello all, I suspect that a threading issue is leading to an object being destructed in one thread context while one of its member functions is still running in another thread context. As a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.