struct.error: unpack requires a buffer of 2 bytes
corobin 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.46.0
- Your python version: Python 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)] on win32
- How did you launch extract_msg?
- I used the extract_msg package
Describe the bug
A new error since updating from 0.45 to 0.46 where opening a message fails
[ If applicable ]
**What code did you use or can we use to reproduce this error?
import extract_msg
msg = extract_msg.openMsg('file.msg')
Is there a message.msg file you want to share to help us reproduce this?
- it happens to almost every message i tried from various time periods. i don't have a convenient sample ready (private info). if required, please let me know.
Traceback
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
msg = extract_msg.openMsg('lipsum.msg')
File "C:\Program Files\Python312\Lib\site-packages\extract_msg\open_msg.py", line 99, in openMsg
if not msg.classType:
File "C:\Program Files\Python312\Lib\functools.py", line 995, in __get__
val = self.func(instance)
File "C:\Program Files\Python312\Lib\site-packages\extract_msg\msg_classes\msg.py", line 847, in classType
return self.getStringStream('__substg1.0_001A')
File "C:\Program Files\Python312\Lib\site-packages\extract_msg\msg_classes\msg.py", line 685, in getStringStream
if self.areStringsUnicode:
File "C:\Program Files\Python312\Lib\functools.py", line 995, in __get__
val = self.func(instance)
File "C:\Program Files\Python312\Lib\site-packages\extract_msg\msg_classes\msg.py", line 798, in areStringsUnicode
return (self.getPropertyVal('340D0003', 0) & 0x40000) != 0
File "C:\Program Files\Python312\Lib\site-packages\extract_msg\msg_classes\msg.py", line 592, in getPropertyVal
return self.props.getValue(name, default)
File "C:\Program Files\Python312\Lib\functools.py", line 995, in __get__
val = self.func(instance)
File "C:\Program Files\Python312\Lib\site-packages\extract_msg\msg_classes\msg.py", line 1046, in props
return PropertiesStore(stream,
File "C:\Program Files\Python312\Lib\site-packages\extract_msg\properties\properties_store.py", line 79, in __init__
prop = createProp(st)
File "C:\Program Files\Python312\Lib\site-packages\extract_msg\properties\prop.py", line 33, in createProp
return FixedLengthProp(data)
File "C:\Program Files\Python312\Lib\site-packages\extract_msg\properties\prop.py", line 90, in __init__
self.__value = self._parseType(self.type, constants.st.STFIX.unpack(data)[0], data)
File "C:\Program Files\Python312\Lib\site-packages\extract_msg\properties\prop.py", line 110, in _parseType
value = constants.st.ST_LE_I16.unpack(value[:3])[0]
struct.error: unpack requires a buffer of 2 bytes
Screenshots
n/a
Additional context
I tried the same on 0.45 and it worked without any problem
Thanks!
Sorry, I forgot that commits with "fixed issue" will close the issue when merged into master. I've fixed this in version 0.46.1 which I just finished releasing on pypi
thanks for the quick fix!