smtplib help

Peter Hansen peter at engcorp.com
Tue Nov 27 01:06:18 CET 2001


David A McInnis wrote:
> 
> Actually, I am using imail from IPSWITCH.  Anyway, it was a speed issue.
> When I called time.sleep(2) from the time module giving me a 2 second sleep,
> I was able to process the messages.
> 
> I don't like being able to send only one msg every 2 seconds.  Any help
> would be appreciated.

Very likely you are misinterpreting the situation.  time.sleep()
is a wonderful "solution" if you want to work around a problem, but
it rarely really addresses the root cause.  There are many types
of problem which you might think are time-related because adding
delays makes the problem go away (or hide, or move), but this
is often misleading.  (Threading issues are a great example.)

In this case, the underlying operating system (Windows) is
eventually releasing the unused sockets to you can use them
again.  This takes some time, but it is probably shorter than 
150 times 2 seconds (5 minutes), or it would not have "solved"
the problem by doing this.

Take the time.sleep() back out and find a real solution, or
live with it for a while as you get other things working
to your satisfaction, then come back later.

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list