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.  :)

On Mon, 2010-10-04 at 18:58 -0500, Peter (Guo) Pei wrote:
> 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:in
> `new'
>         from
> 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:in
> `upload!'
> 
> Here are the related lines of code:
> [code]
> sftp = Net::SFTP.start('somehost', 'someuserid', :password =>
> 'somepassword')
> sftp.upload!("c:\\dba\\1.0.29_QA\\" + windows_path, "./dba/" + line)
> [/code]
> 
> I know the file exists, and I tried different ways of specifying the
> path, with slash and backslash, with full path and particial path... but
> none of those worked.
> 
> I suspect net:sftp 2.0.5 is broken...