SpotlightKid / micropython-ftplib

An FTP client library for MicroPython.
34 stars 17 forks source link

Update ftplib.py #9

Closed eric-armbruster closed 3 years ago

eric-armbruster commented 4 years ago

Closing the file object returned by makefile() WILL close the original socket as well. docs micropython v1.12 https://docs.micropython.org/en/latest/library/usocket.html

SpotlightKid commented 4 years ago

Thanks for the PR, but I'm not sure this is actually needed. The connection used in the retrlines method is created on-the-fly by the ntransfercmd method and isn't used after the transfer is made. So it should be closed. Did you experience an actual error?

Anyway, the PR #7 branch changes the code at the same place anyway and doesn't use a context manager on the connection anymore, but also closes the connection explicitly. The PR is still WIP, because it needs more testing. If you coulld try it out and report back I'd be grateful.

eric-armbruster commented 4 years ago

One year ago, I had to fix it because it was blocking on ESP32 micropython. Looking now, I found a similar code with fix too.
Sorry currently, I no longer work on this, but I keep test for the next time.

SpotlightKid commented 3 years ago

7 is merged now, so this is obsolete.