Using ExtractMsg in a loop?
Question: I am trying to write a script that will extract details from Outlook .msg
files and append then to a .csv file. ExtractMsg
(<https://github.com/mattgwwalker/msg-extractor>) will process the messages
one at a time, at the command line with 'python ExtractMsg.py message' but I
can't work out how to use this to loop through all the messages in the
directory.

I have tried:

    
    
    import ExtractMsg
    import glob
    for message in glob.glob('*.msg'):
        print 'Reading', message
        ExtractMsg(message)
    

This gives "'module' object is not callable". I have tried to look at the
ExtractMsg module but the structure of it is beyond me at the moment. How can
I make the module callable?


Answer: 
    ExtractMsg(message)
    

You are trying to call module object - exactly what error message us telling
you.

Perhaps you need to use ExtractMsg.Message class instead

    
    
    msg = ExtractMsg.Message(message)
    

In the next link on the very bottom you will find example of usage

<https://github.com/mattgwwalker/msg-extractor/blob/master/ExtractMsg.py>

