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

Error uploading files on Windows #38

Closed
Shaunwei opened this issue May 16, 2023 · 2 comments · Fixed by #45
Closed

Error uploading files on Windows #38

Shaunwei opened this issue May 16, 2023 · 2 comments · Fixed by #45
Labels
bug Something isn't working

Comments

@Shaunwei
Copy link
Contributor

I got Quivr up and running, Windows 10, but am having issues when I try to upload a file. It seems it doesn't have permission to access the Temp folder? It should as far as I can tell.

PermissionError: [Errno 13] Permission denied: 'C:\Users\29158~1.1E1\AppData\Local\Temp\tmpl5t8vu99.txt'
Traceback:

File "C:\Users\Laptop\Documents\GitHub\quivr\venv\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script
exec(code, module.dict)
File "C:\Users\Laptop\Documents\GitHub\quivr\main.py", line 66, in
file_uploader(supabase, openai_api_key, vector_store)
File "C:\Users\Laptop\Documents\GitHub\quivr\files.py", line 37, in file_uploader
file_processors[file_extension](vector_store, file)
File "C:\Users\Laptop\Documents\GitHub\quivr\loaders\txt.py", line 5, in process_txt
return process_file(vector_store, file, TextLoader, ".txt")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Laptop\Documents\GitHub\quivr\loaders\common.py", line 19, in process_file
documents = loader.load()
^^^^^^^^^^^^^
File "C:\Users\Laptop\Documents\GitHub\quivr\venv\Lib\site-packages\langchain\document_loaders\text.py", line 17, in load
with open(self.file_path, encoding=self.encoding) as f:

@Shaunwei Shaunwei added the bug Something isn't working label May 16, 2023
@GBry
Copy link

GBry commented May 17, 2023

Experiencing the same thing. Running the terminal as admin doesn't change anything.

@jakenuts
Copy link

jakenuts commented May 17, 2023

I think I found it, not a security issue but a timing/async one possibly. In process_file (common.py) when the temporary file is created, it's deleted before the loader is done with it. Not sure if it's due to an error or an asynchronous loader but here's where it's happening. The call to loader.load() jumps directly back to the "with tempfile" part leaving the scope of the last call and deleting the temp file.

image

Changing the True to False in line 19 of common.py "fixes" it.

with tempfile.NamedTemporaryFile(delete=False,

NateVolt added a commit to NateVolt/quivr that referenced this issue May 17, 2023
StanGirard pushed a commit that referenced this issue May 17, 2023
* defer marking temp file for deletion

closes #38

* manually delete file
Shaunwei pushed a commit to Shaunwei/quiver that referenced this issue May 20, 2023
* defer marking temp file for deletion

closes QuivrHQ#38

* manually delete file
StanGirard pushed a commit that referenced this issue Sep 12, 2023
* defer marking temp file for deletion

closes #38

* manually delete file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants