snowby666 / poe-api-wrapper

👾 A Python API wrapper for Poe.com. With this, you will have free access to GPT-4, Claude, Llama, Gemini, Mistral and more! 🚀
https://pypi.org/project/poe-api-wrapper/
GNU General Public License v3.0
677 stars 81 forks source link

Error when uploading file with gemini_1_5_pro_1m #147

Closed joja16 closed 1 week ago

joja16 commented 2 months ago

I tried uploading the file and using gemini_1_5_pro_1m but both failed. I always get the error message "Close Error: I/O operation on closed file" Do you have any way I can perform other functions similar to gemini_1_5_pro_1m?

image

sunnysktsang commented 1 month ago

Hello @joja16,

Thank you for reporting this issue with the gemini_1_5_pro_1m model's file handling. I have also encountered this problem and have developed a fix that addresses the "Close Error: I/O operation on closed file" error.

I've submitted a pull request that improves the file handling logic within the generate_file function to ensure that files are managed properly throughout their lifecycle. This fix should resolve the error you are experiencing.

Pull Request Details:

I'd appreciate it if the maintainer could review the pull request at their earliest convenience. This change might also benefit others facing similar issues.

For a temporary workaround, you can manually manage the file opening and closing processes in your code, ensuring that file streams are not closed prematurely until all operations are complete. However, the pull request provides a more robust and permanent solution.

Best regards, Sunny