TeamMsgExtractor / msg-extractor

Extracts emails and attachments saved in Microsoft Outlook's .msg files
GNU General Public License v3.0
740 stars 172 forks source link

`extract_msg.message` submodule still importable in version 0.44.0 when it was removed #384

Closed jhhcs closed 1 year ago

jhhcs commented 1 year ago

Bug Metadata

Describe the bug After installing the latest version via pip, the following import fails:

>>> import extract_msg.message
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Workspace\temporary\venv\Lib\site-packages\extract_msg\message.py", line 6, in <module>
    from .message_base import MessageBase
  File "C:\Workspace\temporary\venv\Lib\site-packages\extract_msg\message_base.py", line 23, in <module>
    import chardet
ModuleNotFoundError: No module named 'chardet'

This indicates that the chardet dependency is missing from setup.py. After installing chardet, the following error occurs:

>>> import extract_msg.message
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Workspace\temporary\venv\Lib\site-packages\extract_msg\message.py", line 6, in <module>
    from .message_base import MessageBase
  File "C:\Workspace\temporary\venv\Lib\site-packages\extract_msg\message_base.py", line 34, in <module>
    from .exceptions import (
ImportError: cannot import name 'BadHtmlError' from 'extract_msg.exceptions' (C:\Workspace\temporary\venv\Lib\site-packages\extract_msg\exceptions.py)

This looks more serious; some functions in message_base do raise BadHtmlError, but this symbol is indeed not defined in the exceptions module.

TheElementalOfDestruction commented 1 year ago

Your installation is corrupted (you are now the second person who is experiencing an issue with their install not working correctly, so maybe I need to look at the package on pypi and see if something weird happened). I can tell because the file structure changed, and the file throwing errors shouldn't even exist in your installation. Try uninstalling and the reinstalling the module.

TheElementalOfDestruction commented 1 year ago

Additionally, the structure of the module has changed, and extract_msg.message is no longer a valid import. The Message class is an export of the extract_msg module directly, but it's source module is now extract_msg.msg_classes.message

TheElementalOfDestruction commented 1 year ago

Aha, I see the issue. The source distribution is fine but the wheel has files that shouldn't exist. I'm guessing my build system is missing a cleanup step that I didn't notice. I'll see what I can do to fix future packages. In theory these shouldn't cause problems unless you are trying to use the module with outdated code.

Edit: Correction, a step did exist, but somehow got removed? I'm guessing maybe I transferred over the wrong version of a file when redoing my release build system? Nothing I can really do about the existing releases, but I'll try to release the current version I'm working on soon to fix this. For now, you can uninstall the package and reinstall with the option --no-binary :all: added to the end to ignore the corrupted wheel.

TheElementalOfDestruction commented 1 year ago

Alright, I've fixed this in the 0.45.0 release. The old files are no longer part of the .whl files that are distributed through pypi.