Apr-08-2020, 08:10 PM
Hello,
So after two days of scavenging the internet I have not found anything to help solve my issue. Any help or recommendations would be appreciated.
What I'm trying to do: There is an SFTP server that has a .csv file on it that I need to read. Downloading the csv and reading it is not an option as I'm developing a website.
I am currently using paramiko to access the server. It connects successfully. I use the following line of code to open the csv
1) when I try to use pandas read_csv, it only displays the first row of elements.
Please note this also happens if I open the csv file from my local computer and not the SFTP. So I am assuming I am just using this wrong.
Please note that if I open the csv locally using this method, it works perfectly fine. So I am assuming the problem has something to do with the filetype.
So after two days of scavenging the internet I have not found anything to help solve my issue. Any help or recommendations would be appreciated.
What I'm trying to do: There is an SFTP server that has a .csv file on it that I need to read. Downloading the csv and reading it is not an option as I'm developing a website.
I am currently using paramiko to access the server. It connects successfully. I use the following line of code to open the csv
file = sftp.open('fixed.csv')The problems:
1) when I try to use pandas read_csv, it only displays the first row of elements.
Please note this also happens if I open the csv file from my local computer and not the SFTP. So I am assuming I am just using this wrong.
csv = pandas.read_csv(file) for line in csv: print(line)2) I also tried using the built in csv library. The problem here is that it will not open the file, and I get an error: "TypeError: expected str, bytes or os.PathLike object, not SFTPFile"
Please note that if I open the csv locally using this method, it works perfectly fine. So I am assuming the problem has something to do with the filetype.
with open(file) as csvfile: spamreader = csv.reader(csvfile) for line in spamreader: print(line)I am at my wits end and have no idea how to proceed. Please let me know if I can provide additional information, thank you! Any help would be greatly appreciated.