LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't upload file using SFTP VIs in LabVIEW 2021 (Error -5580893)

Solved!
Go to solution

I am experimenting with LabVIEW 2021 32-bit and the new SFTP VIs.

 

I am trying to upload files to an SFTP server.

 

I can successfully connect to the server, create a directory, download files, and list directory contents.

 

But I am struggling to upload a file.  I did manage to do it yesterday - somehow - just the once!  I don't quite know what I did, but it's not working now. I get Error -5580893, which says "The SFTP operation failed on the server for an unspecified reason. This is the standard error for many SFTP commands."

 

Ozfarmboy_2-1633653755694.png

 

I looked at the examples - there is only one SFTP example, and it is to demonstrate List Directory.  This example is a bit light on, and it would be nice if there were more complex examples, and at the very least an example of a file being uploaded which I thought would be the main use case!

 

I was able to download a file successfully - but it is unclear from the description as to whether local path should be simply a folder or a file.  Turns out you need to give it a filename.  This sort of thing would be easier to work out with better examples.

 

Has anyone tried these VIs, and successfully and repeatably uploaded files to an SFTP server?  I am wondering if I need to play around with the File attributes a bit, but once again - no examples to provide some clues.

 

I am using WinSCP to confirm what's happening on the SFTP server.

 

Attached is a snippet of my code.SFTP Trial codeSFTP Trial code

 

Christopher Farmer

Certified LabVIEW Architect and LabVIEW Champion
DQMH Trusted Advisor
https://wiredinsoftware.com.au

0 Kudos
Message 1 of 9
(2,960 Views)

@Ozfarmboy wrote:

I am experimenting with LabVIEW 2021 32-bit and the new SFTP VIs.

 

I am trying to upload files to an SFTP server.

 

I can successfully connect to the server, create a directory, download files, and list directory contents.

 

But I am struggling to upload a file.  I did manage to do it yesterday - somehow - just the once!  I don't quite know what I did, but it's not working now. I get Error -5580893, which says "The SFTP operation failed on the server for an unspecified reason. This is the standard error for many SFTP commands."

 

Ozfarmboy_2-1633653755694.png

 

I looked at the examples - there is only one SFTP example, and it is to demonstrate List Directory.  This example is a bit light on, and it would be nice if there were more complex examples, and at the very least an example of a file being uploaded which I thought would be the main use case!

 

I was able to download a file successfully - but it is unclear from the description as to whether local path should be simply a folder or a file.  Turns out you need to give it a filename.  This sort of thing would be easier to work out with better examples.

 

Has anyone tried these VIs, and successfully and repeatably uploaded files to an SFTP server?  I am wondering if I need to play around with the File attributes a bit, but once again - no examples to provide some clues.

 

I am using WinSCP to confirm what's happening on the SFTP server.

 

Attached is a snippet of my code.SFTP Trial codeSFTP Trial code

 


That's odd... wonder why you would need to supply a filename?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 9
(2,935 Views)
Solution
Accepted by topic author Ozfarmboy

I managed to resolve this issue.

 

The reason it would not upload the file is that the remote path needs to be a file path (not just a folder path).  So when I explicitly stated the filename in the remote path, it successfully uploaded.  I was then able to download it successfully too.

 

Other things I noticed:

  1. Create Directory function throws Error -5580893 regardless of whether you set "create as needed" input to True or False. Note: It will work if the directory does not previously exist.
  2. I tried PuTTY instead of OpenSSH earlier on.  This worked, but I had to create a connection to the SFTP server via PuTTY first and accept the connection as recognised.  Only then would it work with a PuTTY connection in LabVIEW.  Note: This is just an observation.  The real issue was with the remote path as described above.

 

Updated snippet attached.sftp trial4.png

 

Christopher Farmer

Certified LabVIEW Architect and LabVIEW Champion
DQMH Trusted Advisor
https://wiredinsoftware.com.au

0 Kudos
Message 3 of 9
(2,861 Views)

Hello,

I am trying to dowload COMTRADE files from a METSEPM8240 using SFTP protocol with Labview. The connection works without any error but then when I try to download files it gives an error. This error occurs if I use a file in the local and the remote path. Despite the error, the program deletes the file of the local path but doesn't dowload the file from the remote one.

MartiS99_0-1686206298510.png

I have tried with other functions as upload or make a list but all SFTP functions give me the same error. If I use WinSCP to download the file it works perfectly too. Does anyone have any clues? Maybe there is a problem with the path? I will appreciate your help, thanks in advance.

Here I attach the code.

 

0 Kudos
Message 4 of 9
(1,966 Views)

Could you try my snippet of code above and see how that goes?

 

The error is below - something not right with the connection?

 

Ozfarmboy_0-1686217961392.png

 

Christopher Farmer

Certified LabVIEW Architect and LabVIEW Champion
DQMH Trusted Advisor
https://wiredinsoftware.com.au

0 Kudos
Message 5 of 9
(1,953 Views)

I have tried a copy of your code but it still without working. It can open the connection but then the same error appears.

MartiS99_0-1686223707513.png

Maybe there is a problem with the permisions of the host? Or I have to go to lower level? I have tried different path and different functions but anyone works. Thanks.

I attached the code used.

 

 

0 Kudos
Message 6 of 9
(1,946 Views)

Can you confirm your User/Host/Port fields etc are all ok.

 

Can you try with a different SFTP server to test and see if it's something strange about your current SFTP server?

Christopher Farmer

Certified LabVIEW Architect and LabVIEW Champion
DQMH Trusted Advisor
https://wiredinsoftware.com.au

0 Kudos
Message 7 of 9
(1,921 Views)

Yes, I use WinSCP and it works good, I can dowload all the files. So the user, password, host and port are okay. I want to remark that the open connection with labview works, but then it breaks when I try other functions.

Thaks for your replies Ozfarmboy

0 Kudos
Message 8 of 9
(1,910 Views)

If I go to low level, replacing with subVI contents the SFTP VIs that have errors I finally arrive to a sintactic error that says neither nor bundle nor bundle is allowed on this vi. As it is possible to see in this image.

MartiS99_0-1686559024174.png

To solve this problem I have found that I have to add the VI to the class, but I don't know wich VI should I add in my case. It is possible that the problems to use the SFTP VIs steam from this error? How can I solve this issue?

Thank you

0 Kudos
Message 9 of 9
(1,885 Views)