Python Forum

Full Version: Does pysftp need a logout?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been practicing with ssh, sftp and pysftp.

Somehow I managed to make them all work, which is almost a wonder for me!

If I connect from a bash shell using sftp, I need to enter bye or exit to logout.

In pysftp I see no such choice.

Does pysftp log out automatically when the job is done?
According to https://pysftp.readthedocs.io/en/release...ight=close there is a close method which you can use. If you need the connection for the whole lifetime of your application, then you don't really need to bother closing it, though using a context manager with it would probably be considered a best practice.
Thanks, I didn't see that! I just want to do things correctly.