[issue39928] Pysftp Issue File Upload is not working - put command

Sandeep report at bugs.python.org
Tue Mar 10 20:07:35 EDT 2020


New submission from Sandeep <kthakur.nand at gmail.com>:

Hi 
   We have requirement where we need to get file from client path and then upload the same to vendor directory path. I am not able to upload the file to vendor directory path , however when I tried to use the WINSCP it worked fine. So I thought of checking with Gurus what is wrong I am doing in my script. Appreciate your input.
I will attach my script. Here is what I am doing.

Step1. Clear the client directory path
Step2. Make a call to HVAC Vault to get the username and password for client and vendor server
Step3. Use the username and password to establish connection using pysftp for client. 
Step4. Store the file in local path.
Step5. Segregate the file into different path based on file type
Step6  Establish a connection to vendor and copy the file to vendor.
Step7  Close the client and Vendor connection

Please see the file attached.

Also below is the error which I am getting

---------------------------------------------------------
ERROR:root:Error in getting the file from EBS Outbound Server
Traceback (most recent call last):
  File "FILE_TRANSFER_PROCESS.py", line 191, in file_transfer
    vendor.put(src_file, dst_file)
  File "/d01/python3/lib64/python3.6/site-packages/pysftp/__init__.py", line 364, in put
    confirm=confirm)
  File "/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line 759, in put
    return self.putfo(fl, remotepath, file_size, callback, confirm)
  File "/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line 720, in putfo
    s = self.stat(remotepath)
  File "/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line 493, in stat
    t, msg = self._request(CMD_STAT, path)
  File "/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line 813, in _request
    return self._read_response(num)
  File "/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line 865, in _read_response
    self._convert_status(msg)
  File "/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line 894, in _convert_status
    raise IOError(errno.ENOENT, text)
FileNotFoundError: [Errno 2] /custom/OWO/ECE_OWO_20200303_143895.dat

----------
components: Tests
files: File_Transfer_Process_Client.py
messages: 363870
nosy: Sandeep
priority: normal
severity: normal
status: open
title: Pysftp Issue File Upload is not working - put command
type: crash
versions: Python 3.7
Added file: https://bugs.python.org/file48967/File_Transfer_Process_Client.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39928>
_______________________________________


More information about the Python-bugs-list mailing list