Bug in luigi.contrib.ftp.py on putting file to ftp from Windows
When calling the "put" operation from a windows machine using luigi.contrib.ftp.RemoteFileSystem, the code fails with a max recursion depth error.
This seems to be due the call to normpath in the beginning of both the put methods
def _sftp_put(self, local_path, path, atomic):
normpath = os.path.normpath(path)
directory = os.path.dirname(normpath)
From the OS docs https://docs.python.org/3/library/os.path.html, normath "On Windows, it converts forward slashes to backward slashes." Most FTP servers use forward slashes as separators, so this messes up the remote path.
I think adding somthing like
def _sftp_put(self, local_path, path, atomic):
normpath = os.path.normpath(path)
directory = os.path.dirname(normpath)
if os.path.sep =='\\':
directory = directory.replace('\\','//')
might just be enough to fix it
I believe that this is a dupe of a ticket @elessarelfstone put in in the past that got closed due to inactivity. https://github.com/spotify/luigi/issues/2880
A better improvement actually might be to just leave the remote name as is
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If closed, you may revisit when your time allows and reopen! Thank you for your contributions.
so what's up? Can we add some fixes in next releases