So far, so good. The problem comes when we try the same thing in Windows: the first example (data) works, but the second example (data/) results in this error:
c:\work>python test.py data/
Traceback (most recent call last):
File "c:\work\test.py", line 13, in <module>
c2.put(sys.argv[1], "/tmp", recursive=True)
File "C:\Program Files\Python39\lib\site-packages\scp.py", line 203, in put
self._send_recursive(files)
File "C:\Program Files\Python39\lib\site-packages\scp.py", line 373, in _send_recursive
self._chdir(last_dir, asbytes(root))
File "C:\Program Files\Python39\lib\site-packages\scp.py", line 361, in _chdir
self._send_pushd(to_dir)
File "C:\Program Files\Python39\lib\site-packages\scp.py", line 387, in _send_pushd
self._recv_confirm()
File "C:\Program Files\Python39\lib\site-packages\scp.py", line 415, in _recv_confirm
raise SCPException('No response from server')
scp.SCPException: No response from server
Short description
If I copy "src" to "dst", it works. If I copy "src/" to "dst", it fails (only when running on Windows).
More details
Let' s see it with an example.
First of all, in Linux, let's create a test folder structure:
Next, let's create an example (
test.py
) that makes use of the scp library:Finally, let's use this script to copy the folder data to a remote server:
We can also run the same script with "data/" instead of "data" if we want to transfer the contents of the folder and not the folder itself:
So far, so good. The problem comes when we try the same thing in Windows: the first example (data) works, but the second example (data/) results in this error: