How should threads be terminated? (related to 'Help with thread related tracebacks')

Peter Hansen peter at engcorp.com
Sat Jun 18 12:20:47 EDT 2005


Maxwell Hammer wrote:
> On Thu, 16 Jun 2005 16:20:23 -0400, Peter Hansen wrote:
>>If the question was well formulated, and it's been more than a couple of 
>>days, you should consider reposting.  It's very unusual for a post with 
>>such a subject (if it was a clear question) to get _no_ feedback around 
>>here.
> 
> Fair enough. The question is not expressed clearly for others. Do you have
> any suggestions as to how to describe the problem clearer?

I hope you didn't get the impression I was criticizing.  I don't recall 
your post at all, and definitely wasn't suggesting that it was unclear, 
merely asking you to verify that it was and, if not, rewrite it upon 
reposting.

As for suggestions to make it clearer: I can't make any without digging 
back for your previous posting.  I generally don't take the time to do 
that since older messages are often gone from my server very quickly, 
and I don't like spending time digging around on Google Groups to find 
it.  Sorry, it's just one of my approaches to conserving my own time, 
selfishly.

> I can think of no other way but to say I have an app that when I terminate
> it, completes ok, However the last thing that happens before the shell
> prompt returns is that there is a traceback *within* python.
> (The actual post goes into more details of course.)

This sounds very much like the problem where, during the interpreter 
shutdown, all globals in all modules are rebound to None, but if daemon 
threads are still running they will quickly crash as a result and raise 
exceptions, usually referring to AttributeErrors where "None" doesn't 
have an attribute of a particular kind, usually the name of a method.

If I'd seen your post, I would probably have responded with as much at 
the time.  If you do a Google Groups search for some of those keywords 
and my name, you'll certainly find a half dozen other threads where 
someone else asked a similar question, even if I missed your post.

> I just took a guess that it is *thread* related from the output of the
> traceback. I'm still learning python, so how could one pose the problem
> *clearer*? 
> 
> And thanks for the feedback regarding threads, by the way.

No problem.  And if this post didn't help, please do repost the whole 
original question so I can see it again, and those who read the group 
via the mailing list will get a fresh email, etc...

-Peter



More information about the Python-list mailing list