I have troubles with the Garbage Collection and Cleanup ob some
Objects.
class Crawlerlog will open a file for appending.
class Crawler will create an instance of crawlerlog
controller Main will create an instance of Crawler and start it in a
new thread.
The Thread will finish, but neither Crawler.__del__ nor
Crawlerlog.__del__ are called.
Some pseudocode
def thread(crawler):
try:
crawler.work()
finally:
print "finished"
del crawler
class Crawlerlog(object).
def __init__(self):
self.file = open("somefile", "a+")
def __del__(self):
close(self.file)
class Crawler(object):
def __init__(self):
self.log = Crawlerlog()
def __del__(self):
print "bye"
def Main(BaseController):
def index(self):
crawler = Crawler()
t = Thread(target=thread, args=(crawler) )
t.start()
return Response("started")
Greetings
Christoph
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---