According to transfer.put() docs, I should be able to either provide local path to a file (as a string), or a file-like object.
When using the former (string), I can specify in the remote path only the target directory. This is used in some examples:
c.put('myfiles.tgz', '/opt/mydata')
But when I try to do the same ( c.put('file.txt', '/home/me/dir'), I always end up with IOError: Failure, because it is actually behaving as if the local path was a file-like object and not a string.
It fails specifically on paramiko.transport.sftp.sftp._log: [chan 0] open('/home/me/dir', 'wb')
The solution is to always provide the full path, e.g.
c.put('file.txt', '/home/me/dir/file.txt')
But that is inconsistent with the docs and examples.
Finally, having to provide the full path to $HOME is less than ideal, but there seems to be issue for that already #1653
- Tested in Windows 10
- Fabric 2.0.0
- Paramiko 2.4.1
- Invoke 1.0.0
According to transfer.put() docs, I should be able to either provide local path to a file (as a string), or a file-like object.
When using the former (string), I can specify in the
remotepath only the target directory. This is used in some examples:But when I try to do the same (
c.put('file.txt', '/home/me/dir'), I always end up withIOError: Failure, because it is actually behaving as if thelocalpath was a file-like object and not a string.It fails specifically on
paramiko.transport.sftp.sftp._log: [chan 0] open('/home/me/dir', 'wb')The solution is to always provide the full path, e.g.
But that is inconsistent with the docs and examples.
Finally, having to provide the full path to
$HOMEis less than ideal, but there seems to be issue for that already #1653