jeremyephron / simplegmail

A simple Gmail API client for applications in Python
MIT License
336 stars 73 forks source link

sockets left open #76

Closed Dan1001 closed 1 year ago

Dan1001 commented 2 years ago

Hi,

This is a really useful project - thank you.

One small niggle: I have a script which checks my inbox every few minutes, but unfortunately simplegmail seems to leave sockets open each time, and so I get warnings like this:

WARNING | /usr/lib/python3.8/json/decoder.py:353: ResourceWarning:unclosed <ssl.SSLSocket fd=49, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.117', 57974), raddr=('17.250.80.100', 443)>

I can't immediately see a close() method - is there something else I can do to tidy up?

thanks,

Dan

jeremyephron commented 1 year ago

Hi @Dan1001, thanks for pointing this out, I've added a fix for this in https://github.com/jeremyephron/simplegmail/tree/close-service-explicitly-in-threads.

Dan1001 commented 1 year ago

thank you!

If I, hypothetically, was a stupid person, how would I get the benefit of the fix? Will pip automatically update it, or do I have to compile myself?

Apologies for what is probably a dumb question...

jeremyephron commented 1 year ago

@Dan1001 I was just letting you know prematurely, but I just released v4.1.1 with this change, so you can pip install --upgrade simplegmail to get the latest version.

Dan1001 commented 1 year ago

That is fantastic. Thank you! And thanks for a great project.