FTP.exit(): AttributeError 'dict' object has no attribute 'session'
FTP.exit() raises AttributeError: 'dict' object has no attribute 'session' whenever another cached session exists (and del session is a no-op).
for session in FTP_SESSIONS:
if session.session == self.session: # session is a dict
del session # only unbinds the loop variable
self.session.quit()
(main.py:272-275). FTP_SESSIONS is a module-level list shared by all projects. Once one project with reuseSessions: true has put a session in it, a save in a project with "reuseSessions": false (or any exit(force=True)) hits the AttributeError and self.session.quit() is never reached, so the connection is leaked.
Reproduced live in Sublime Text 4 with Simple FTP Deploy 1.8.1 installed via Package Control, saving real files in a real project window. To avoid needing a server, ftplib.FTP was replaced by a recording stub (the failing logic is all before/around the network calls). Reproduced by appending {'session': object(), 'host': 'other'} to FTP_SESSIONS and calling FTP(config).exit() on a config with reuseSessions: false -> AttributeError: 'dict' object has no attribute 'session'.
Fix: FTP_SESSIONS[:] = [s for s in FTP_SESSIONS if s['session'] is not self.session] before quit(), and wrap quit() in try/except for already-closed connections.
Claude reports: closing this after 30 days with no response. Reopen it if it is still relevant.