This is due to a missing feature in Python's ftplib
. An issue was reported long ago: https://github.com/python/cpython/issues/63699#issuecomment-2122745826
There you will find workarounds that work for modern versions of Python. It's mostly about sub-classing FTP_TLS
.
See this comment for example: https://github.com/python/cpython/issues/63699#issuecomment-2871986658