Closed johnfarina closed 6 years ago
Hi John,
Thanks for reporting this. Yep, this is an issue with the self.fd
not being properly pointed to the newly converted .magnitude
file (it was still pointing to the .vec
file). The reason why self.fd
is used and not self.path
is that by using self.fd
we can ensure SQLite doesn't modify the .magnitude
file by giving it read only permissions.
Here's the commit and build pipeline that fixes this issue: https://gitlab.com/Plasticity/magnitude/commit/0a182875fa6ca8adf79316559ad761889fa4264e
Once the tests pass on the CI, it will be deployed as version 0.1.16 on PyPI. You can upgrade pymagnitude
on your system with pip3 install pymagnitude -U
. Please post back here if it resolved your issue or add a :+1: and I'll close out this issue.
That commit fixed the bug. Thanks for the quick turnaround!
Possibly related to #2.
This happens to me when trying to create a Magnitude object from a .vec file, on both linux and macOS, under python 3.6.
Both
self.fd
andself.path
seem to be set correctly, but something breaks in the call toself._db()
. Here's an exerpt from a minimal session using one of the pretrained fasttext .vec filesPopping into the debugger,
self.path
points to the temporary .magnitude file, and instantiating aMagnitude
object directly from there works just fine.So I modified the definition of
self._db
in__init__.py
to just useirrespective of the OS, and that seemed to solve the problem. There's likely a better way of doing things though. (I haven't looked through the code very carefully, and I don't totally understand the nuances of
/dev/fd/
)