Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with NamedTemporaryFile on Windows #334

Open
brogrammeur opened this issue May 10, 2023 · 1 comment
Open

Problem with NamedTemporaryFile on Windows #334

brogrammeur opened this issue May 10, 2023 · 1 comment

Comments

@brogrammeur
Copy link

On Windows it seems that NamedTemporaryFile is having a problem when using the new index feature -> Nothing is written to the temporary file before it is deleted.

When I add the "delete=False" in the arguments (ex. tempfile.NamedTemporaryFile(mode='w+b', delete=False)), it works correctly.

It is probably related to what is discussed in that post, even if I not in a subprocess ... : https://stackoverflow.com/questions/15169101/how-to-create-a-temporary-file-that-can-be-read-by-a-subprocess

@brogrammeur
Copy link
Author

Would it be a good idea to replace the temporary files used for serialization and deserialization with pickle?

In save method:
self.serialized_document_index = pickle.dumps(self.document_index)

In load method:
top2vec_model.document_index = pickle.loads(top2vec_model.serialized_document_index)

@brogrammeur brogrammeur reopened this May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant