finalion / WordQuery

word fast-querying addon for anki
https://ankiweb.net/shared/info/775418273
GNU General Public License v3.0
291 stars 61 forks source link

Unpack requires a string argument of length 4 #67

Open TruongQToan opened 7 years ago

TruongQToan commented 7 years ago

When I installed word query add on onAnki 2.0.48 and window 10, I got this error.

Wrong behavior

An error occurred in an add-on. Please post on the add-on forum: https://anki.tenderapp.com/discussions/add-ons

Traceback (most recent call last): File "C:\Users\toanb\AppData\Roaming\Anki2\addons\wquery\service\manager.py", line 142, in run IndexBuilder(path) File "C:\Users\toanb\AppData\Roaming\Anki2\addons\wquery\libs\mdict\mdict_query.py", line 103, in init self._make_mdx_index(self._mdx_db) File "C:\Users\toanb\AppData\Roaming\Anki2\addons\wquery\libs\mdict\mdict_query.py", line 129, in _make_mdx_index mdx = MDX(self._mdx_file) File "C:\Users\toanb\AppData\Roaming\Anki2\addons\wquery\libs\mdict\readmdict.py", line 636, in init MDict.init(self, fname, encoding, passcode) File "C:\Users\toanb\AppData\Roaming\Anki2\addons\wquery\libs\mdict\readmdict.py", line 101, in init self.header = self._read_header() File "C:\Users\toanb\AppData\Roaming\Anki2\addons\wquery\libs\mdict\readmdict.py", line 267, in _read_header adler32 = unpack('<I', f.read(4))[0] struct.error: unpack requires a string argument of length 4

After comment this line of code, I got another key error on line 277 encoding = header_tag[b'Encoding']. How can I fix this bug? Thank in advance.