winapi - MS Outlook CDO/MAPI Blocking Python File Output? -


Here I have an example of the problem in which I am running I access an Outlook mailbox and retrieve messages I'm using the Python Win32 extension.

Below is a script that "Hello World" should be written in a text file. I need to get some messages from the Outlook mailbox and I've seen some strange things. Once I attach the mailbox, then I can not print any file in the file. A small version that displays the problem is given below:

#! Win32com.client import dispatch from / usr / bin / env dragon fh = open ('foo.txt', 'w') fh. Writing ('hello') fh.close () session = dispatch ('mappi departure session') session . Logon ('', '', 0,1,0,0, 'exchange.fu. \ nprodreport'); Session.Logoff () fh = open ('foo.txt', 'a') fh.write ('world') fh.close ()

If I click on the mailbox and the following lines Comment, it clearly works well:

  Session = Dispatches ('MAPI Farewell') session. Logon ('', '', 0, 0, 'exchange.foo.com \ ncorey'); Session.Logoff ()  

Opening a session in the mailbox between my script, why block further file output? any idea? (Other operations are not blocked, just this file I / O asfaik)

Yes, directory change is CDO A known archive while using MAPI / "Documents" in MSDN (for example) you can easily reproduce in Python:

  import os import win32com.client Print os.getcwd () win32com.client.Dispatch ("MAPI.Session") print os.getcwd ()  

Comments