TeamMsgExtractor/msg-extractor

ModuleNotFoundError

ALR06082016 opened this issue ยท 2 comments

In order to get your bug addressed in a timely manner, or at all ๐Ÿ˜ƒ, please fill out the below bug report. Please try to make it as easy as possible for us to understand what is going on. We may close out any bugs or issues without warning that are not complete or coherent.

In the bug template below anything is [square brackets] should be filled out or removed if the item doesn't apply.

Should you encounter an error that has not already been reported, please do the following when reporting it:
Bug Metadata

  • Version of extract_msg: [0.42.1]

  • Your python version: Python 3.8

  • How did you launch extract_msg?

    • I used the extract_msg package

Describe the bug
ModuleNotFoundError: No module named 'extract_msg' after Installed the latest version.

[ If applicable ]
**What code did you use or can we use to reproduce this error?

[put your code here]
import extract_msg
import os






#dir_msg = r'I:\ODT\TEAM_MEMBERS\PeterZhuo\Python\Get_attachment_from_Outlook_msg\msg'
#dir_extract = r'I:\ODT\TEAM_MEMBERS\PeterZhuo\Python\Get_attachment_from_Outlook_msg\attachment'


dir_msg = r'U:\Hong Kong\_HK-HKHON01SRFS02_LocalFiles\DFCL HK\Wellcome\Wellcome 2022\2022 Raw Data\TTA (3 banners)\Email'
dir_extract = r'U:\Hong Kong\_HK-HKHON01SRFS02_LocalFiles\DFCL HK\Wellcome\Wellcome 2022\2022 Raw Data\TTA (3 banners)\Attachment'
log_file = r'U:\Hong Kong\_HK-HKHON01SRFS02_LocalFiles\DFCL HK\Wellcome\Wellcome 2022\2022 Raw Data\TTA (3 banners)\extract_log.txt'

try:
    os.remove(log_file)
except:
    pass

idx = 1
for path, subdirs, files in os.walk(dir_msg):
    for index, name in enumerate(files):
        filename, file_extension = os.path.splitext(name)
        # filesize = os.path.getsize(os.path.join(path, name))  # os.stat(os.path.join(path, name))
        # print("File size is", filesize)
        # print("File Name + EXT is " + name)  # file name with ext
        # print("File Name is " + filename)  # file name without ext
        # print("Extention is " + file_extension)  # ext

        # print("Full file path is " + os.path.join(path, name))
        fullpath = os.path.join(path, name)
        # print(fullpath)

        if file_extension.upper() == '.MSG':
            try:
                msg = extract_msg.openMsg(fullpath)
                msg.saveAttachments(customPath=dir_extract)
            except Exception as e:
                # print(fullpath)
                # print(e)
                with open(log_file, 'a') as f:
                    f.write(str(idx) + ' - '+ fullpath + '\n')
                    f.write(str(e)+ '\n\n')

                idx = idx + 1

Is there a message.msg file you want to share to help us reproduce this?
- [ ] Uploaded message (drag and drop on this window)
- [ ] Emailed message as an attachment to admins: [Enter Subject Line Here]

**Traceback**
 (most recent call last)

[Put your traceback here]
 File "U:\Australia\_AU-IT\ODT\TEAM_MEMBERS\PeterZhuo\Python\Get_attachment_from_Outlook_msg\Main.py", line 2, in <module>
    import extract_msg
ModuleNotFoundError: No module named 'extract_msg'

**Screenshots**
![image](https://github.com/TeamMsgExtractor/msg-extractor/assets/120021635/ec58a777-4d88-431a-8a7f-fc1e4f0e8c67)


**Additional context**
[Add any other context about the problem here.]

Sounds like something went wrong when you installed the module. Check your site-packages directory for your installation and make sure the extract_msg folder is there properly. If it is, make sure it contains files inside, including __init__.py

Closing due to inactivity