470,826 Members | 1,961 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,826 developers. It's quick & easy.

Probable Pywin32 (win32com.client) bug??

This is a heads-up on a possible memory corruption type of bug in
recent and present versions of Python/win32com. I dont know if its
general, or specific to using win32com.client to access CDO as my
example does.

My script was tiny - it just opens a MAPI/CDO session and traverses
the email folders - but it keeps crashing Python at random places.

After 2 days of trying everything without success, I've finally
discovered that it depends on how I sequence through a (valid)
collection of folders returned by CDO:

If I do this:

for o in Folders:
....do something with the 'o' object...

Then the script seems to work OK, but it later crashes Python (in
CDO.DLL according to Windows). If it does crash, its always at the
same (unrelated) place in the script, though this changes "randomly"
whenever the script is changed or run in a different environment (eg.
IDE or command line). This suggests to me that there is some kind of
memory corruption going on.

But if I do this:

o = Folders.GetFirst()
while o:
....do something with the 'o' object...
o = Folders.GetNext()

Then the whole script works (the same) and is totally robust (no
Python crashes).

Could this be some kind of corruption going on within win32com when
the first technique is used? I've googled around, and as far as I can
see this is perfectly valid code.

Is this group the appropriate place to post this, eg. for Mark H to

I have the whole 50-line script available if anyone else wants to try

My system:
XP SP 1a
Outlook 2003 (with its CDO)
Python 2.3.2 (last ActiveState distribution) or 2.3.4
Pywin32 2.02 for Python 2.3
Jul 18 '05 #1
0 1185

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Justin Stockton | last post: by
2 posts views Thread by Michael Jordan | last post: by
1 post views Thread by Philippe C. Martin | last post: by
2 posts views Thread by agostino.russo | last post: by
reply views Thread by Do Re Mi chel La Si Do | last post: by
reply views Thread by Andrea Gavana | last post: by
reply views Thread by mazerj2006 | last post: by
1 post views Thread by kernel1983 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.