Traceback (most recent call last):
File "/Users/isaiah.melendez/Documents/python/alr_to_ho.py", line 38, in <module>
ftpTransmit()
File "/Users/isaiah.melendez/Documents/python/alr_to_ho.py", line 34, in ftpTransmit
sftp.put(ftpALR[i], 'C:\CBASYNC')
File "/Users/isaiah.melendez/Documents/python/venv/lib/python3.7/site-packages/pysftp/__init__.py", line 364, in put
confirm=confirm)
File "/Users/isaiah.melendez/Documents/python/venv/lib/python3.7/site-packages/paramiko/sftp_client.py", line 759, in put
return self.putfo(fl, remotepath, file_size, callback, confirm)
File "/Users/isaiah.melendez/Documents/python/venv/lib/python3.7/site-packages/paramiko/sftp_client.py", line 714, in putfo
with self.file(remotepath, "wb") as fr:
File "/Users/isaiah.melendez/Documents/python/venv/lib/python3.7/site-packages/paramiko/sftp_client.py", line 372, in open
t, msg = self._request(CMD_OPEN, filename, imode, attrblock)
File "/Users/isaiah.melendez/Documents/python/venv/lib/python3.7/site-packages/paramiko/sftp_client.py", line 813, in _request
return self._read_response(num)
File "/Users/isaiah.melendez/Documents/python/venv/lib/python3.7/site-packages/paramiko/sftp_client.py", line 865, in _read_response
self._convert_status(msg)
File "/Users/isaiah.melendez/Documents/python/venv/lib/python3.7/site-packages/paramiko/sftp_client.py", line 898, in _convert_status
raise IOError(text)
OSError
#import libraries
import os
import pysftp
from locker import *
# query for file function
alr_file = '/Users/isaiah.melendez/Documents/python/test'
#alr_file = 'C:\TBOffice\TBOLink\TEK\Export'
#prep list to store data in
ftpALR = []
ftp_un_dec = cipher_suite.decrypt(cipher_text2)
ftp_pw_dec = cipher_suite.decrypt(cipher_text)
#look for file and store in list and iterate
def findFile():
for item in os.listdir(alr_file):
if item.endswith('.mdb'):
#ftpALR.append(alr_file + '\\' + item)
ftpALR.append(alr_file + '/' + item)
#print(ftpALR)
# ftp transmission function
def ftpTransmit():
# list ftp dir
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
with pysftp.Connection(host='co2.cbapps.com', username=ftp_un_dec.decode('utf-8'), password=ftp_pw_dec.decode('utf-8'), port=2222, cnopts=cnopts) as sftp:
length = len(ftpALR)
for i in range(length):
sftp.put(ftpALR[i], 'C:\CBASYNC')
print("Transmission Success")
findFile()
ftpTransmit()
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.