I tried to upload files from a windows box to a linux box, and I used
net:sftp 2.0.5. However I got the following error message:
C:/ruby/lib/ruby/gems/1.8/gems/net-sftp-2.0.5/lib/net/sftp/operations/upload.rb:168:in initialize': expected a file to upload (ArgumentError) from C:/ruby/lib/ruby/gems/1.8/gems/net-sftp-2.0.5/lib/net/sftp/session.rb:98:innew’
C:/ruby/lib/ruby/gems/1.8/gems/net-sftp-2.0.5/lib/net/sftp/session.rb:98:in upload' from C:/ruby/lib/ruby/gems/1.8/gems/net-sftp-2.0.5/lib/net/sftp/session.rb:103:inupload!’
In my experience, more often than not the gem isn’t broken - it’s your
use. (As I’ve witnessed through a lack of response to some of my posts
stating exactly that).
And while I can’t answer your question directly, I would suggest that
you are likely doing it wrong, rather than sftp being broken on such a
simple test case.
Have you exhausted your troubleshooting? Are you sure? Have you tried
other file access statements (such as “File.open”) to confirm your path
statements? A step earlier, have you confirmed valid instantiation of
your object? For instance, by calling a different method on ‘sftp’?
Are you beyond 100% positive that your value in ‘windows_path’ is
correct? Maybe it has a newline tacked on the end?
Of course, as these types of problems usually go, you’ve hopefully
already solved this.