Probable Pywin32 (win32com.client) bug??

Discussion in 'Python' started by neblackcat, Jul 15, 2004.

  1. neblackcat

    neblackcat Guest

    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
    see?

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

    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
    neblackcat, Jul 15, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tim Golden
    Replies:
    2
    Views:
    677
    Mark Hammond
    Jul 19, 2004
  2. Replies:
    0
    Views:
    364
  3. Pierre Quentel
    Replies:
    21
    Views:
    650
  4. Ronald Fischer
    Replies:
    0
    Views:
    106
    Ronald Fischer
    Jun 18, 2007
  5. Ruby Quiz

    [QUIZ] Probable Iterations (#141)

    Ruby Quiz, Sep 28, 2007, in forum: Ruby
    Replies:
    14
    Views:
    197
    Eugene Kalenkovich
    Oct 4, 2007
Loading...

Share This Page